JS案例:鼠标移入和移出时在页面显示不同的图形

来自CloudWiki
跳转至: 导航搜索
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>鼠标移动显示不同图片功能</title>
<script type="text/javascript">
	function mouseover(){
		//函数返回结果false
	   	document.getElementById("image1").src = "images/2.jpg"
 	}
	 function mouseOut() {
        document.getElementById("image1").src = "images/1.jpg"
    }
</script>
</head>
<body>
<p>
<img id="image1" name="image1" src="images/1.jpg" onmouseover="mouseover()" onmouseout="momouseout()" />
</p>
</body>
</html>