摇动的图像
- <html>
- <head>
- <script type="text/javascript">
- function shakeleft()
- {
- document.getElementById('image').style.position="relative"
- document.getElementById('image').style.left="3"
- timer=setTimeout("shakeright()",10)
- }
-
- function shakeright()
- {
- document.getElementById('image').style.left="0"
- timer=setTimeout("shakeleft()",10)
- }
-
- function stoptimer()
- {
- clearTimeout(timer)
- }
- </script>
- </head>
-
- <body>
- <b>请把鼠标移动到图像上,会看到它在摇动:)</b><br />
- <img id="image" src="/i/eg_smile.gif"
- onmouseover="shakeleft()"
- onmouseout="stoptimer()" />
- </body>
-
- </html>