<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>事件</title>
<style type="text/css">
img{width: 400px;}
</style>
</head>
<body>
<img src="images/1.jpg" id="pic">
<script type="text/javascript">
var o=document.getElementById("pic");
o.onmouseenter=function(){
this.src="images/2.jpg"
}
o.onmouseleave=function(){
this.src="images/1.jpg"
}
</script>
</body>
</html>