案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function lighton()
5
{
6
document.getElementById('myimage').src="/img/eg_bulbon.gif"
7
}
8
function lightoff()
9
{
10
document.getElementById('myimage').src="/img/eg_bulboff.gif"
11
}
12
</script>
13
</head>
14
15
<body>
16
<img id="myimage" onmousedown="lighton()" 
17
onmouseup="lightoff()" 
18
src="/img/eg_bulboff.gif" width="100" 
19
height="180">
20
<p>请点击灯泡,把它点亮!</p>
21
</body>
22
</html>
23