0
我刚刚在html上添加了这样的图像。如何更改鼠标悬停的图标
<img src="Your image address" width="500" height="500">
但我想结束意味着添加鼠标时鼠标光标来到图像,然后图像应该改变,我用什么代码在这里。由于
我刚刚在html上添加了这样的图像。如何更改鼠标悬停的图标
<img src="Your image address" width="500" height="500">
但我想结束意味着添加鼠标时鼠标光标来到图像,然后图像应该改变,我用什么代码在这里。由于
文件层次:Vidzpra/index.html,然后Vidzpra /图片有两个图像black.jpg和yellow.jpg 下面的代码(HTML与JavaScript的内部)上改变鼠标的图像:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>onMouserOver Img change</title>
<script>
function changeImg(el){
el.src = "images/yellow.jpg";
}
function fixImg(el){
el.src = "images/black.jpg";
}
</script>
</head>
<body>
<div>
<img onmouseover="changeImg(this)" onmouseout="fixImg(this)" border="0" src="images/black.jpg" alt="" align="middle" >
</div>
</body>
</html>
谢谢你解决我的问题。 – 2013-03-16 05:52:07
http://www.w3schools.com/jsref/event_onmouseover.asp – David 2013-03-15 13:22:02