几乎不可能实现的问题,高手请进 若选中第m行,textbox在n列tbl.rows[m].cells[n].children[0].disabled=true; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script type="text/javascript"> //<![CDATA[ function foo(o) { var e = o; while (o.tagName!="TR") { o=o.parentNode; } var a=o.getElementsByTagName("INPUT"); for (var i=0; i<a.length; i++) { if (a[i].type.toLowerCase()=="text") a[i].disabled=e.checked; } } //]]> </script> <table border="0" cellpadding="0" cellspacing="0" width="100%" > <tr> <td><input type="checkbox" onclick="foo(this)"/></td> <td><input value="http://www.never-online.net"/></td> </tr> <tr> <td><input type="checkbox" onclick="foo(this)"/></td> <td><input/></td> </tr> </table> </body> <script>function fn(obj){if(obj.checked){ obj.parentElement.parentElement.cells[1].children[0].disabled=true;}else{ obj.parentElement.parentElement.cells[1].children[0].disabled=false;}}</script><table><tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr><tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr><tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr><tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr><tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr></table> 写一个函数参数是this然后将checkbox的check事件中调用这个函数。通过this应该可以得到是第几行,可以通过sobj =obj.id.substring(0,obj.id.indexOf("txt",0)得到行的标记。后面加上文本框的名。var s="document.Form1."+ sobj +"txt.disabled=false";将文本框设为不可用。eval(s); 鼠标拖动滚动条的焦点图 WEB前段技术等级评论,大家来讨论,标题要长 根据时间改变css 点饥listbox列表值怎么能让右框架里出现新的网页~ gb2312转utf-8问题,急呀!!!!! jquery操作table 如何实现取值,从前一页到下页 JavaScript 函数传递对象,到底是按值传递还是按引用传递? js输出html代码,结果直接显示的代码 bootstrap,使用模态框传递不同参数显示不同的分类内容,但是模态框不刷新,何解? 可不可以实现这样的功能!点激单选按纽1可以在下边文本框内输入内容,可点击单选按纽2时文本框不可见或文本框不可输入! 如何寻找页面中的字符串
//<![CDATA[
function foo(o) {
var e = o;
while (o.tagName!="TR") {
o=o.parentNode;
}
var a=o.getElementsByTagName("INPUT");
for (var i=0; i<a.length; i++) {
if (a[i].type.toLowerCase()=="text")
a[i].disabled=e.checked;
}
}
//]]>
</script>
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr>
<td><input type="checkbox" onclick="foo(this)"/></td>
<td><input value="http://www.never-online.net"/></td>
</tr>
<tr>
<td><input type="checkbox" onclick="foo(this)"/></td>
<td><input/></td>
</tr>
</table>
</body>
function fn(obj){
if(obj.checked){
obj.parentElement.parentElement.cells[1].children[0].disabled=true;
}
else{
obj.parentElement.parentElement.cells[1].children[0].disabled=false;
}
}
</script>
<table><tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr>
<tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr>
<tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr>
<tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr>
<tr><Td><input type=checkbox onclick="fn(this)"></td><td><input type=textbox ></td></tr>
</table>
然后将checkbox的check事件中调用这个函数。
通过this应该可以得到是第几行,可以通过sobj =obj.id.substring(0,obj.id.indexOf("txt",0)得到行的标记。后面加上文本框的名。var s="document.Form1."+ sobj +"txt.disabled=false";将文本框设为不可用。eval(s);