wrexhamafc234
Programmer
hello, any ideas how I can create a single function that will allow me to automatically check checkboxes?
e.g. if checkbox1 (id=1) is checked, all other checkboxes will be checked
if checkbox 1-2 (id=1-2) is checked, checkboxes 1-2-1 and 1-2-2 will be checked.
Any ideas?
e.g. if checkbox1 (id=1) is checked, all other checkboxes will be checked
if checkbox 1-2 (id=1-2) is checked, checkboxes 1-2-1 and 1-2-2 will be checked.
Code:
html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] >
<head runat="server">
<title>Untitled Page</title>
<SCRIPT type='text/javascript'>
function check(field) {
}
</script>
</head>
<body>
<form name=myform action="" method=post runat=server>
<table>
<tr><td>
<b>Checkbox Example</b><br>
<input type=checkbox name=list id="1" onClick="this.value=check(this.form.list)">Root<br>
<input type=checkbox name=list id="1-1"><br>
<input type=checkbox name=list id="1-2" onClick="this.value=check(this.form.list)"><br>
<input type=checkbox name=list id="1-2-1"><br>
<input type=checkbox name=list id="1-2-2"><br>
<input type=checkbox name=list id="1-3" onClick="this.value=check(this.form.list)"><br>
<input type=checkbox name=list id="1-3-1"><br>
<input type=checkbox name=list id="1-3-2"><br>
<input type=checkbox name=list id="2-1"><br>
<input type=checkbox name=list id="2-2"><br>
<input type=checkbox name=list id="2-3"><br>
</td></tr>
</table>
</form>
</body>
</html>
Any ideas?