日期:2014-05-18  浏览次数:21232 次

如何设置input 的背景颜色?
这样试了不对:background-color:red 如何设置input 的背景颜色?其中type为text

------解决方案--------------------
HTML code

<style>
input.text{background-color:red}
</style>
<input type="text" class="text">
<input type="text" style="background-color:blue">

------解决方案--------------------
学习....

------解决方案--------------------
楼主的环境问题吧!
------解决方案--------------------
HTML code
<style> 
  input.text{background-color:red}   
</style>
    
<script>   
  function   mm()   
  {   
      var   a   =   document.getElementsByTagName("INPUT");   
      for(var   i=0;   i<a.length;   i++)   if(a[i].type=="text")  a[i].className="text";  
  }   
</script>   
    
<body onload="mm()">
    
<input/>
<input/>

</body>