Use mouse in/out action to trigger the style change : Mouse Event « Event « JavaScript Tutorial






<html>
<head>
<title>Style Example</title>
</head>
<body>
<P>Move your mouse over the square.</p>
<div id="div1"
     style="background-color: red; height: 50px; width: 50px"
     onmouseover="this.style.backgroundColor = 'blue'"
     onmouseout="this.style.backgroundColor = 'red'">
</div>
</body>
</html>








15.8.Mouse Event
15.8.1.Get mouse clicked button
15.8.2.Is Shift key pressed during the mouse click
15.8.3.Is alt key pressed during the mouse click
15.8.4.Is control key pressed during the mouse click
15.8.5.Mouse event target element name
15.8.6.Mouse event from and to elements (IE)
15.8.7.Mouse event related element (Firefox)
15.8.8.onmouseover event handler
15.8.9.onmouseout event handler
15.8.10.onmousedown event handler
15.8.11.onmouseup event handler
15.8.12.onclick mouse event handler
15.8.13.ondblclick mouse event handler
15.8.14.Display current mouse position in status bar (IE)
15.8.15.Use mouse in/out action to trigger the style change
15.8.16.Get mouse client X and Y
15.8.17.Get mouse screen X and Y
15.8.18.Set element's pixelTop and pixelLeft to current mouse event (IE)
15.8.19.Get X/Y screen position (IE)