日期:2014-05-16 浏览次数:20404 次
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
</head>
<body>
<table >
<thead>
<th></th>
<th>测试内容</th>
</thead>
<tbody id ="testtbody">
<tr>
<td><input type='checkbox' /></td>
<td>test1</td>
</tr>
<tr>
<td><input type='checkbox' /></td>
<td>test2</td>
</tr>
<tr>
<td><input type='checkbox' /></td>
<td>test3</td>
</tr>
<tr>
<td><input type='checkbox' /></td>
<td>test4</td>
</tr>
</tbody>
</table>
</body>
<script type="text/javascript">
function disableTr()
{
var table = document.getElementById("testtbody");
var rows = table.rows;
var tr = rows[2];
var checkboxTd = tr.cells[0];
var checkbox = checkboxTd.childNodes[0];
debugger;
checkbox.disabled = true;
//这里禁用第三行的checkbox
}
disableTr();
</script>
</html>
onLoadSuccess:function(){//加载完毕后获取所有的checkbox遍历
$('#test input:checkbox').each(function(index,el){
if(/*.条件.*/)el.disabled=true;
});
}