Monday, 16 January 2012

Increase Image Size in onmouseover and onmouseout

Question:-How to Increase Image Size in onmouseover and onmouseout ?

Answer:-
<img id ="imageID" src ="http://www.dialurdoctor.com/images/DialURDoctor_logo.png" />

<script type ="text/javascript" >
   var image = document.getElementById('imageID'),
    imageWidth = image.width,
    imageHeight = image.height;
   image.onmouseover = function() {
            image.width = 2.0 * imageWidth;
            image.height = 2.0 * imageHeight;
        }
        image.onmouseout = function() {
            image.width = imageWidth;
            image.height = imageHeight;
        }
 </script>

No comments:

Post a Comment