I want to make a page that has a table of various webpages with checkboxes next to each. I want the user to be able to select multiple sites then search the sites using a google bar. I have a table where each cell has a form filled with checkboxes. each cell has a checkall button that checks all the options in that cell. I would like to add a checkbox to select all the options on the page. (yes I could just leave this option out but I kind of want to know how to access all the boxes in the cells anyway so that I can search with google like I want.) here is basically what I have. Its the section inside checkPage function that needs help at this point
<html>
<head>
<script type="text/javascript">
function checkAll(checkname, bx) {
for (i = 0; i < checkname.length; i++){
checkname[i].checked = bx.checked? true:false;
}
}
function checkPage(bx){
var bxs = document.getElementByTagName ( "table" ).getElementsByTagName ( "link" );
for(i = 0; i < bxs.length; i++){
bxs[i].checked = bx.checked? true:false;
}
}
</script>
</head>
<body>
<input type="checkbox" name="pageCheck" value="yes" onClick="checkPage(this)"><b>Check Page</b>
<table border="1" name ="table">
<tr>
<td name ="list00">
<form name ="list00">
<input type="checkbox" name="Check_ctr" value="yes" onClick="checkAll(document.list00.link, this)"><b>Check All</b><dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
</form>
</td>
<td><form name ="list01">
<input type="checkbox" name="Check_ctr" value="yes" onClick="checkAll(document.list01.link, this)"><b>Check All</b><dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
</form></td>
</tr>
<tr>
<td><form name ="list10">
<input type="checkbox" name="Check_ctr" value="yes" onClick="checkAll(document.list10.link, this)"><b>Check All</b><dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
</form></td>
<td><form name ="list11">
<input type="checkbox" name="Check_ctr" value="yes" onClick="checkAll(document.list11.link, this)"><b>Check All</b><dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
<input type="checkbox" name="link" value="something.com">something.com<dd>
</form></td>
</tr>
</table>
</body>
</html>
See Question&Answers more detail:os