从黑白到彩色

  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="/i/eg_landscape.jpg" onmouseover="color()" onmouseout="gray()" />
  24. </body>
  25. </html>