Execute a JavaScript when moving the mouse pointer onto an image using onmouseover - Javascript DOM Event

Javascript examples for DOM Event:onmouseover

Description

Execute a JavaScript when moving the mouse pointer onto an image using onmouseover

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="http://java2s.com/resources/a.png" alt="Smiley" width="32" height="32">

<script>
function bigImg(x) {//from  ww  w .j a  va2 s. c  o  m
    x.style.height = "64px";
    x.style.width = "64px";
}

function normalImg(x) {
    x.style.height = "32px";
    x.style.width = "32px";
}
</script>

</body>
</html>

Related Tutorials