phani
08-31-2002, 12:48 PM
hai,
iam having problem in checkboxes. i want to checkbox to be checked on clicking the button.i have to give the same name to each of the checkbox. it's working fine while giving different names to each checkbox. here is the code:
<script>
function check()
{
for (i=1;i<document.forms[0].elements.length-1;i++)
{
document.forms[0].checkbox1.checked=true;
}
}
</script>
<body>
<form>
<input type="checkbox" name="checkbox1" value=1>
<input type="checkbox" name="checkbox1" value=2>
<input type="checkbox" name="checkbox1" value=3>
<input type="checkbox" name="checkbox1" value=4>
<input type="button" value=check onclick="check()">
</form>
</body>
iam having problem in checkboxes. i want to checkbox to be checked on clicking the button.i have to give the same name to each of the checkbox. it's working fine while giving different names to each checkbox. here is the code:
<script>
function check()
{
for (i=1;i<document.forms[0].elements.length-1;i++)
{
document.forms[0].checkbox1.checked=true;
}
}
</script>
<body>
<form>
<input type="checkbox" name="checkbox1" value=1>
<input type="checkbox" name="checkbox1" value=2>
<input type="checkbox" name="checkbox1" value=3>
<input type="checkbox" name="checkbox1" value=4>
<input type="button" value=check onclick="check()">
</form>
</body>