高手来解答:在CSS中如何区分<input type=text>和<input type=button>,搞定加100分

某css文件部分内容:
input{
background-color:#ff0000;
}

这个css控制所有的input背景都是#ff0000,不管是文本框还是按钮都由此来控制。
我现在想让文本框背景颜色为#ffffff,按钮背景颜色为#ccccff,这个css文件怎么写?前提是不要修改其它页面,不可给按钮专门引用class

谢谢帮忙

---------------------------------------------------------------

1<head>
2<style>   
3input{background-color:expression(this.type=="text"?'#ffffff':'#ccccff') }   
4</style>
5</head>
1<input type="text"/>
1<input type="button" value="fason"/>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus