案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function shakeleft()
5
{
6
document.getElementById('myLink').style.position="relative"
7
document.getElementById('myLink').style.left="3"
8
timer=setTimeout("shakeright()",10)
9
}
10
function shakeright()
11
{
12
document.getElementById('myLink').style.left="0"
13
timer=setTimeout("shakeleft()",10)
14
}
15
function stoptimer()
16
{
17
clearTimeout(timer)
18
}
19
</script>
20
</head>
21
22
<body>
23
<a id="myLink" href="//www.w3xue.com/"
24
onmouseover="shakeleft()" onmouseout="stoptimer()">请把鼠标移动到链接上</a>
25
</body>
26
27
</html>
28