源码
资讯
  当前位置:源码网网络学院网页制作JavaScript → JavaScript教程:onmouseover控制图片
特别推荐
热点TOP10
本周下载排行
本月下载排行
JavaScript教程:onmouseover控制图片
日期:2007年12月13日 作者: 人气: 查看: [大字体 中字体 小字体]

JavaScript教程:onmouseover控制图片

<html>
<head>
<style>
.imgActive
{
 border:3px solid #000000;
}
</style>
<script type="text/javascript">
<!--
function  attachImgEventListener()

 var imageArray=document.getElementById("MM").getElementsByTagName("img");
    for(var i=0;i<imageArray.length;i++)
    {
       imageArray[i].onmouseover=imgOverListener;
     imageArray[i].onmouseout=imgOutListener;
    }
}

function imgOverListener(event)
{
 var event=event || window.event;
 var source = event.srcElement || event.target;
 source.className="imgActive";
}
function imgOutListener(event)
{
 var event=event || window.event;
 var source = event.srcElement || event.target;
 source.className="";
}
-->
</script>
</head>
<body onLoad="attachImgEventListener()">
<div id="MM">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">

</div>
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
<img src="http://www.webjx.com/images/common/xml.gif" width="50px" height="50px">
</div>
</body>
</html>

(出处:源码网)

百度搜索 Google搜索 雅虎搜索 我要投稿
相关文章: 相关软件: