代码示例:(标识:dhtm_gray)
<html>
<head>
<style>
img
{
filter:gray()
}
</style>
<script type="text/javascript">
function color()
{
document.getElementById('myImage').style.filter=false
}
function gray()
{
document.getElementById('myImage').style.filter="gray()"
}
</script>
</head>

<body>
<b>Mouse over the image</b><br />
<img id="myImage" src="/static/demo/images/eg_landscape.jpg" onmouseover="color()" onmouseout="gray()" />
</body>
</html>
运行结果: