Examples of commonly used expression in CSS

Source: Internet
Author: User

1. Change the page all <a href, request target is _blank, new open a window
<style>
A
{
Target:expression (this.target= "_blank");
}
</style>

2. Eliminate links on the page dashed box
<style type= "Text/css" >
A {star:expression (Onfocus=this.blur)}
</style>
3. Using CSS custom attribute expression to bulk define table row interval background
<style type= "Text/css" >
tr{background-color:expression (' #F8F8F8, #EFEFEF '. Split (', ') [rowindex%2]);}
</style>
4. Control the alignment of the table
Define a pseudo-class in CSS:
. mytablecenter{myalign:expression (this.align= "right");}
Refer to the. Mytablecenter style in <table>
5. Place the position of an element according to the size of the browser
. MyClass {left:expression (document.body.offsetwidth-110 + "px");}
6. Distinguish a read-only text box
<style>
Input{background-color:expression (this.readonly && this.readonly==true)? " #f0f0f0 ":")}
</style>
<input type= "text" Name= "" >
<input type= "text" Name= "" readonly>
7. Replace the image CSS
The #imgScript {/* Here uses the object ID to pass the style, or you can define a CSS function */
Star:expression (
onmouseover = function ()
{
/* Replace picture */
if (this.hover! = null) {
THIS.name = THIS.SRC;
THIS.SRC = this.src= "/files/beyondpic/2006-5/29/0652912505890151.jpg", ' _over.jpg ');
This. HASCHG = 1;
}
},
onmouseout = function ()
{
/* Restore the original picture */
if (this. Haschg! = null) {
THIS.SRC = THIS.name;
This. HASCHG = null;
}
}
)

}

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.