案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
img2=new Image()
5
img2.src="/img/eg_landscape3.jpg" 
6
function changeImage()
7
{
8
document.getElementById('myImage').src=img2.src
9
}
10
</script>
11
</head>
12
13
<body>
14
15
<p>当您把鼠标移动到图片上时,会出现一幅新的图像。</p>
16
<img id="myImage" onmouseover="changeImage()" border="0" src="/img/eg_landscape2.jpg">
17
<p>新图像会立即出现,这是因为您的浏览器已经加载了这幅图像。</p>
18
19
</body>
20
</html>
21