为属性为readonly的input设置样式

原文网址:http://lilywangcn.iteye.com/blog/973943


属性为readonly的input不允许用户输入内容,然而在ie或chrome中,属性为readonly的input 和一般input从界面上来看没有任何区别,会给用户输入带来稍许不便。可以通过为其设置css来加以区分。

 

在ie浏览器中:

Java代码   收藏代码
  1. input{background-color:expression((this.readOnly && this.readOnly == true)? "#efefef":"");}  

 

 在chrome中

Java代码   收藏代码
  1. input[readonly]{  
  2.     background-color: #efefef;  
  3. }  

猜你喜欢

转载自blog.csdn.net/qq_42310995/article/details/80894358