1.用css的expression判断表达式

2.用css中的type选择器

3.用javascript脚本实现

4.如果你用Microsoft Visual Studio 2005 或者后续版本开发项目,恭喜,你还可以使用skin。

下面就来讲解一下各个办法的详细实现和它们的优缺点。

1:用css的expression判断表达式

实现代码参考:

  

    input 

    { 

    background-color:expression(this.type=="text"?'#FFC':''); 

    } 
另一种
  input[type="text"] 

    { 

    background-color:#FFC; 

    } 

    

    input[type="password"] 

    { 

    background-image:url(BG.gif); 

    } 

    

    input[type="submit"] 

    { 

    background-color:blue; 

    color:white; 

    } 

    

    input[type="reset"] 

    { 

    background-color:navy; 

    color:white; 

    } 

    

   input[type="radio"] 

    { 

    /*In FF,Some radio style like background-color not been supported*/ 

    margin:10px; 

    } 

    

    input[type="checkbox"] 

    { 

    /*In FF,Some checkbox style like background-color not been supported*/ 

    margin:10px; 

    } 

    

    input[type="button"] 

    { 

    background-color:lightblue; 

    } 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-06-29
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2022-01-08
  • 2021-05-19
  • 2022-12-23
  • 2021-08-31
  • 2022-02-13
相关资源
相似解决方案