Try this:
Change checkbox values and click button.....
<form name="test">
<input type="checkbox" name="checkgroup" checked />
<input type="checkbox" name="checkgroup" />
<input type="checkbox" name="checkgroup" checked />
<input type="button" value="Button" name="B1" onclick="check_boxes();"></form>
<script type="text/javascript">
function check_boxes()
{
for (i=0; i<document.test.checkgroup.length; i++){
if (document.test.checkgroup[i].checked==true)
alert("Checkbox at index "+i+" is checked!")
}
}
</script>
From: http://www.javascriptkit.com/jsref/checkbox.shtml
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment