<分区>
Possible Duplicate:
Using JavaScript to manipulate HTML input (checkbox) elements via type instead of name.
为什么这不起作用?请帮忙。这是检查 MVC View 上所有复选框的代码。
<script type="text/javascript">
function SetAllCheckBoxes(doc) {
var c = new Array();
c = doc.getElementsByTagName('input');
for (var i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
c[i].checked = true;
}
}
}
</script>
<input type="checkbox" name="Test" onclick="SetAllCheckBoxes('PartialViewName')"/>