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> 

 .....

posted on 2009-06-28 04:58  阿C's  阅读(221)  评论(0)    收藏  举报