CSS mouse response event through, move, click on the sample introduction _javascript tips

Source: Internet
Author: User
Several mouse triggers for CSS events.
Description
OnMouseDown when the mouse is pressed
Trigger when OnMouseOver mouse passes
OnMouseUp press the mouse to release the mouse when it triggers
onmouseout when mouse moves out
OnMouseMove when the mouse is moving
Copy Code code as follows:

<TITLE>CSS Mouse Response Event </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >
. off{background-color: #00FF66; padding:100px;}
. Up{background-color: #FF0000; padding:100px}
</style>
<body>
<ul class=off onmouseout= "this.classname=" "onmouseover=" this.classname= "Up" >
<li>onmousedown when the mouse is pressed
Trigger when <li>onmouseover mouse passes
<li>onmouseup press the mouse to release the mouse when it triggers
<li>onmouseout when mouse moves out
<li>onmousemove when mouse moves </li>
</ul>
</body>

Copy Code code as follows:

<span style= "color:red;" > Mouse through table color style:<br></span>

Copy Code code as follows:

<style>
Table {background-color: #000000; cursor:hand; width:100%;}
TD {
/* Set onmouseover Event * *
Onmouseover:expression (Onmouseover=function () {this.style.borderColor = ' blue '; this.style.color= ' red '; This.style.backgroundColor = ' Yellow '});
/* Set onmouseout Event * *
Onmouseout:expression (Onmouseout=function () {this.style.bordercolor= '; this.style.color= '; This.style.backgroundColor = '} ');
Background-color: #ffffff;
}
</style>
Control the form to color interlacing:
Simple application:
<style type= "Text/css" >
<!--
TR {background-color:expression (this.sectionrowindex%2==0)? #E1F1F1 ": #F0F0F0")}
-->
Advanced application: Color per cell
<style type= "Text/css" >
<!--
TR {background-color:expression (this.sectionrowindex%2==0)? Red ": Blue")}
TD {Background-color:expression (this.cellindex%2==0)? "":( (this.parentelement.sectionrowindex%2==0)? " Green ":" Yellow ")}
-->
</style>

To add a CSS file reference:
Copy Code code as follows:

<link id= "CSSStyle" "rel=" stylesheet "type=" Text/css "href=". /style.css "/>
Related Article

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.