预加载图像
- <html>
- <head>
- <script type="text/javascript">
- img2=new Image()
- img2.src="/i/eg_landscape3.jpg"
- function changeImage()
- {
- document.getElementById('myImage').src=img2.src
- }
- </script>
- </head>
- <body>
- <p>当您把鼠标移动到图片上时,会出现一幅新的图像。</p>
- <img id="myImage" onmouseover="changeImage()" border="0" src="/i/eg_landscape2.jpg">
- <p>新图像会立即出现,这是因为您的浏览器已经加载了这幅图像。</p>
- </body>
- </html>