怎样用JS设置text中文本的颜色或text文本框的背景色? <INPUT onMouseOver="this.style.backgroundColor='red';this.style.color='#ffffff'" onMouseOut="this.style.backgroundColor='';this.style.color='#000000'" type="text" value="ff"> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 问题是这样的:在一个表格中,每行都有一个checkbox,当checkbox被选中时,这一行的所有文本框的背景色都变为红色,怎么做啊!谢谢 <input type="text" onmouseover="this.style.color='pink';this.style.backgroundColor='deepskublue';"> <script>var tt = 1;</script><BODY><table><tr><td><input type="checkbox" id="cb1" onclick="if(tt) {txt1.style.backgroundColor='pink';tt=0;} else {txt1.style.backgroundColor='#ffffff';tt=1;}"><input type="text" id="txt1"></td></tr></table></BODY>不好意思,写多一个,嘿嘿 To: aniude(阿牛的乜乜)如果一行中有多个文本框时怎么办啊?你那个只有一个呀 <html><head><style>.noChildElementsTr input{ background-color:#cccccc; color:red;}</style></head><body>显示<table width=100% ><tr ><td><input type=checkbox onclick="this.parentElement.parentElement.className=(this.checked?'noChildElementsTr':'')" ></td><td>aaa <input value=aaa></td><td>aaa <input value=bbb></td></tr><tr ><td><input type=checkbox onclick="this.parentElement.parentElement.className=(this.checked?'noChildElementsTr':'')" ></td><td>aaa <input value=aaa></td><td>aaa <input value=bbb></td></tr></table></body></html> jQuery新手问题,急求高人帮忙解答!万分感谢!! 请问51job城市选择的JS怎么用? 给数值分组的问题 jsp 按钮 修改数据库数据 该怎么写 大家来帮我个忙啊求带有阴历的js我给个效果啊!我这个js阴历是错误的郁闷! 如何把javascript以包含文件的形式在html中调用 css层次问题,很奇怪哟。 关于参数传递问题,帮帮忙... 求大神看看这个Ajax动态去数据库获取值的代码,为什么进不了Action里面 jquery 元素移动 radio的问题 请问在javascript中的,这条语句正确的写法?
在一个表格中,每行都有一个checkbox,当checkbox被选中时,这一行的所有文本框的背景色都变为红色,怎么做啊!
谢谢
var tt = 1;
</script>
<BODY>
<table>
<tr>
<td>
<input type="checkbox" id="cb1" onclick="if(tt) {txt1.style.backgroundColor='pink';tt=0;} else {txt1.style.backgroundColor='#ffffff';tt=1;}"><input type="text" id="txt1">
</td>
</tr>
</table>
</BODY>
不好意思,写多一个,嘿嘿
如果一行中有多个文本框时怎么办啊?
你那个只有一个呀
<style>
.noChildElementsTr input
{
background-color:#cccccc;
color:red;
}
</style>
</head><body>
显示
<table width=100% >
<tr >
<td>
<input type=checkbox onclick="this.parentElement.parentElement.className=(this.checked?'noChildElementsTr':'')" >
</td>
<td>
aaa <input value=aaa>
</td>
<td>
aaa <input value=bbb>
</td>
</tr>
<tr >
<td>
<input type=checkbox onclick="this.parentElement.parentElement.className=(this.checked?'noChildElementsTr':'')" >
</td>
<td>
aaa <input value=aaa>
</td>
<td>
aaa <input value=bbb>
</td>
</tr>
</table></body></html>