본문 바로가기

개발하자/자바스크립트

onmouseover,onmouseout

<html>
 <head>
 <style type="text/css">
 img { width:50px; height:50px; }
 </style>
 <script>
 window.onload=function(){
 document.img1.onmouseover=mOver;
 document.img1.onmouseout=mOut;
 }
 function mOver(){
 this.style.width="150px";
 this.style.height="150px";
 }
 function mOut(){
 this.style.width="50px";
 this.style.height="50px";
 }
 </script>
 </head>
 <body>
 <img src="image/bgimg.jpg" name="img1">
 </body>
</html>