[Instance name]
The color changes when the mouse is moved in or out.
[Instance description]
When a user moves the mouse over a button or link, the link and button color are changed to highlight the user's choice. The color of the default link is automatically changed. In this example, we will learn how to manually set this effect for the button.
[Instance Code]
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> title page </title>
</Head>
<Body>
<Input type = "submit" value = "move the mouse here"
Name = "btn1" onMouseOut = this. style. color = "blue"
OnMouseOver = this. style. color = "red">
</Body>
</Html>
[Running Effect]
[Difficulties]
This example focuses on the application of mouse events. When the mouse moves to the control, the ''onmouseover "event is triggered. When the mouse moves, the" onMouseOut "event is triggered. Both events use style. color to change the color of the control.