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> 

 .....

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-14
  • 2021-06-11
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案