案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<style>
4
img
5
{
6
filter:gray()
7
}
8
</style>
9
<script type="text/javascript">
10
function color()
11
{
12
document.getElementById('myImage').style.filter=false
13
}
14
function gray()
15
{
16
document.getElementById('myImage').style.filter="gray()"
17
}
18
</script>
19
</head>
20
21
<body>
22
<b>Mouse over the image</b><br />
23
<img id="myImage" src="/img/eg_landscape.jpg" onmouseover="color()" onmouseout="gray()" />
24
</body>
25
</html>
26