sorry for asking noob question but i am just not getting it
when i click on OK it prints both Maths and Computer no matter what the checkbox selection is !!!
when i click on OK it prints both Maths and Computer no matter what the checkbox selection is !!!
Code:
<html>
<head>
<script type="text/JavaScript">
function validateForm()
{
var cbox=myform.subjects;
for(var i=0;i<cbox.length;i++)
{
if(cbox[i].checked==true);
document.write(cbox[i].value);
}
}
</script>
</head>
<body>
<form action="" method="get" ID="myform" NAME="myform" onsubmit="validateForm();">
<input type="checkbox" name="subjects" value="Maths">Maths<br/>
<input type="checkbox" name="subjects" value="Computer">Computer<br/>
<input type="submit" value="OK" >
</form>
</body>
</html>