分享

JavaScript教程:onmouseover控制图片

 昵称3821191 2010-10-10

JavaScript教程:onmouseover控制图片

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./images/common/xml.gif" width="50px" height="50px">
<img src="http://www./images/common/xml.gif" width="50px" height="50px">
<img src="http://www./images/common/xml.gif" width="50px" height="50px">
</div>
<img src="http://www./images/common/xml.gif" width="50px" height="50px">
<img src="http://www./images/common/xml.gif" width="50px" height="50px">
<img src="http://www./images/common/xml.gif" width="50px" height="50px">
<img src="http://www./images/common/xml.gif" width="50px" height="50px">
</div>
</body>
</html>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约