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

Javascript examples for DOM Event:onmouseenter

Description

Execute a JavaScript when moving the mouse pointer onto an image:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<script>
function bigImg(x) {//w w  w.j  a v  a 2  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