萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> JS使用oumousemove和oumouseout動態改變圖片顯示的方法

JS使用oumousemove和oumouseout動態改變圖片顯示的方法

 本文實例講述了JS使用oumousemove和oumouseout動態改變圖片顯示的方法。分享給大家供大家參考。具體如下:

鼠標放到圖片上時圖片會自動變大,鼠標離開圖片還原

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 <!DOCTYPE html> <html> <head> <script> function bigImg(x) { x.style.height="64px"; x.style.width="64px"; } function normalImg(x) { x.style.height="32px"; x.style.width="32px"; } </script> </head> <body> <img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="smiley.gif" alt="Smiley" width="32" height="32"> <p>The function bigImg() is triggered when the user moves the mouse pointer over the image.</p> <p>The function normalImg() is triggered when the mouse pointer is moved out of the image.</p> </body> </html>
copyright © 萬盛學電腦網 all rights reserved