[網摘]如何用CSS控制input標籤

來源:互聯網
上載者:User

1.

.....  
  <style>  
  input   {   my:expression(doStyle(this))}  
  </style>  
  <script   language="JavaScript">  
  <!--  
  function   doStyle(e){  
    if(e.type=="text")   e.style.color="red";  
    if(e.type=="password")   e.style.color="blue";  
  }  
  //-->  
  </script>  
  </head>  
  <body>  
  <input   type="password">  
  <input   type="text"   name=""   value="abc">  

 

2. 
  .....

<style>  
  .a   {font-size:   12px;   color:   #FF00000}  
  </style>  
   
  <script   language=javascript>  
  var   a   =   document.getElementsByTagName("input");  
  for   (var   i=0;   i<a.length;   i++)  
  {  
        if(a[i].type=="text")   a[i].className   =   "a";   //所有type=text的input都會用a這個樣式了  
  }  
  </script> 

 .....

相關文章

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.