Mega Code Archive

 
Categories / JavaScript Tutorial / Event
 

Use mouse inout action to trigger the style change

< 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>