当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JavaScript教程:onmouseover控制图片

Javascript
RDF:Web数据集成的元数据解决方案
你的IP
弹出精彩-弹出式菜单详解
在Web网页上使用VBScript 和JScript
图档结构树的设计与关联
JavaScript电子表
输入日期之改进模式
如果你想打开一个新页面时给浏览者一些惊喜的话,试试这个
HTML文档中用JavaScript调用Microsoft Agent的COM接口编程
JavaScript修改注册表
JavaScript构造XML树结构
一个很不错的主页效果。。你试试!!!
一个用js加密的好玩的东东
在网页上显示一个会移动的透明时钟的代码。。。
如何显示年月日及星期问题
javascript手冊-c
javascript手冊-d
javascript手冊-f
javascript手冊-g
javascript手冊-i

Javascript 中的 JavaScript教程:onmouseover控制图片


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 122 ::
收藏到网摘: n/a

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