본문 바로가기

   
Programming/Javascript

Javascript mouseover

반응형

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

       <head>

             <title></title>

             <meta name="generator" content="editplus" />

             <meta name="author" content="김종현" />

             <script type="text/javascript">

                    //onmouseover : 태그에 마우스가 올라갈때 발생

                    //Show(this) 복사 한다 obj

                    function Show(obj) {

                           //onmouseover : 태그에 마우스가 올라갈때 발생

                           //alert("이미지가 올라갔습니다.");

 

                           //롤오버이미지 - 메뉴, 아이템

                           //다른태그도 가능하다 img 태그외에도

 

                           //document.getElementById("img1").src="images/angry.png";

                           //이미지태그를 통쨰로 넘겨준것이다.

                           obj.src = "images/angry.png";

 

                    }

 

                    function Hide(obj) {

                           //document.getElementById("img1").src="images/adore.png";

                           obj.src = "images/adore.png";

                    }

                          

             </script>

       </head>

 

       <body>

             <!--Ex10.htm -->

             <img src="images/adore.png" onmouseover="Show(this);" id="img1" onmouseout="Hide(this);" />

             <img src="images/adore.png" onmouseover="Show(this);" id="img2" onmouseout="Hide(this);" />

             <img src="images/adore.png" onmouseover="Show(this);" id="img3" onmouseout="Hide(this);" />

             <img src="images/adore.png" onmouseover="Show(this);" id="img4" onmouseout="Hide(this);" />

             <img src="images/adore.png" onmouseover="Show(this);" id="img5" onmouseout="Hide(this);" />

             <img src="images/adore.png" onmouseover="Show(this);" id="img6" onmouseout="Hide(this);" />

       </body>

</html>

 

 

반응형