案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<style>
4
body
5
{
6
background:#000000;
7
color:#00FF00;
8
font-weight:bold;
9
}
10
a{color:#CCCCCC;}
11
</style>
12
13
<script type="text/javascript">
14
function cursor(text)
15
{
16
trail.innerHTML=text
17
trail.style.visibility="visible"
18
trail.style.position="absolute"
19
trail.style.left=event.clientX+10
20
trail.style.top=event.clientY
21
}
22
23
function hidecursor()
24
{
25
trail.style.visibility="hidden"
26
}
27
</script>
28
29
</head>
30
<body>
31
32
<h1>请把鼠标移动到链接上:</h1>
33
34
<a href="/index.html" onmousemove="cursor('访问 W3xue.com')" onmouseout="hidecursor()">W3xue.com</a><br />
35
<a href="http://www.baidu.com" onmousemove="cursor('转到 Baidu')" onmouseout="hidecursor()">Baidu</a><br />
36
<a href="http://www.so.com" onmousemove="cursor('使用 360搜索 进行搜索!')" onmouseout="hidecursor()">360so</a><br />
37
38
<span id="trail" style="visibility:hidden">Hello</span>
39
40
</body>
41
</html>