![]() |
购物专题 | 基金专题 | 性专题 | 饮食专题 | 教育专题 | 生活大参考 | 园林资讯 | 园艺库 | 健康专题 | |
| 论文专题 | 家庭养花 | 园林景观 | 盆景奇石 | 激情图库 | 农业资料库 | 园林古建 | 英文站 | 花卉栽培 |
input 有多种TYPE,我如何写一个style, 让它仅对 type=text 生效呢?
现在我只能定义一个class, 然后在所有的input type=text中用calss限定:
css:
input.MyTextBox {
......
}
HTML :
<input type=text class=MyTextBox ....>
---------------------------------------------------------------
.....
<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">
.....
---------------------------------------------------------------
<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>
浙ICP备 :07003766号 Copyright © 2001-2007 JUBAO163,All rights reserved. |