CSS skillfully use expression to distinguish a read-only text box

Source: Internet
Author: User
Tags expression
css|express| text Box

For text boxes, read-only state and normal state, the browser does not make any special tags, on the surface, the effect is the same, so that for users, ease of use is not very high.

Of course, we can change the background color of the read-only text box to distinguish, this time we need the programmer to determine whether the text box is read-only, and then introduce the corresponding CSS, undoubtedly increased the workload.

Here, using expression to provide a solution, you only need to introduce this CSS on each page, the rest are judged by the program itself, as follows:

Input{background-color:expression (this.readonly && this.readonly==true)? " #f0f0f0 ":")}
<input type= "text" Name= "" >
<input type= "text" Name= "" readonly>
<input type= "text" Name= "" >
<input type= "text" Name= "" readonly>

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.