Color Change code when moving the mouse in or out

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.