Javascript實現圖片翻轉


  使用Js的對象屬性能實現簡單的翻轉效果。通過onMouseover事件和onMouseOut事件就能實現鼠標移到鏈接上和移開鏈接發生反應。給兩個圖片加上鏈接實現都能翻轉的效果。

  reverse.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>圖片翻轉Demo</title>
<style type="text/css">
h1{color:yellow;
text-align:center;}

</style>
</head>
<body>
<h1>實現圖片翻轉</h1>
<img src="smile.jpg" name="smileimage"
onMouseOver="window.document.smileimage.src='smilereverse.jpg';"
onMouseOut="window.document.smileimage.src='smile.jpg';"
>
<br>
<p>
<a href="#" 
onMouseOver="window.document.smileimage.src='smilereverse.jpg';"
onMouseOut="window.document.smileimage.src='smile.jpg';"
><img src="submit.png" name="turn" border="0" width="298" height="68"></a>
</p>
</body>
</html>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM