怎样通过CSS控制input输入框有readonly属性的背景色


 
<html>
 
<head>
 
<title>Online JavaScript Tester</title>
 

<style type="text/css">
 
input{
 
background-color:expression(this.readOnly==true?"#EEEEEE":"#FFFFFF");
 
}
 

input[readonly]{
 
background-color:#EEEEEE;
 
}
 

 

</style>
 

<script>
 

 

</script>
 
</head>
 
<body>
 
<input type="text" readonly/>
 
<input type="text"/>
 
<input type="text" readonly="true"/>
 
<input type="text" readonly="false"/>
 
</body>
 
</html>

 

posted @ 2014-03-25 10:24  龙猫爸爸  阅读(2462)  评论(0编辑  收藏  举报