

Programs in JavaScript
14. onMouseOver and onMouseOut example.
<html>
<head>
<style>
#msg{
width:200px;
height:200px;
background-color:#FC6;
}
</style>
<script type="text/javascript">
function mover()
{
document.getElementById("msg").innerHTML="Hell to all";
}
function mout()
{
document.getElementById("msg").innerHTML="Bye to all";
}
</script>
</head>
<body>
<img src="teddybear.jpg" onmouseover="mover()" onmouseout="mout()" />
<div id="msg">
</div>
</div>
</body>
</html>
Output :