onmouseover/onmouseout - 当把鼠标指针移入/移出图像时

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function bigImg(x) {
  6. x.style.height = "150px";
  7. x.style.width = "150px";
  8. }
  9.  
  10. function normalImg(x) {
  11. x.style.height = "50px";
  12. x.style.width = "50px";
  13. }
  14. </script>
  15. </head>
  16. <body>
  17.  
  18. <img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0"
  19. src="/i/eg_smile.gif" alt="Smiley" width="128" height="128">
  20.  
  21. <p>当用户将鼠标指针移到图像上时,会触发 bigImg() 函数。</p>
  22.  
  23. <p>当鼠标指针移出图像时,会触发 normalImg() 函数。</p>
  24.  
  25. </body>
  26. </html>