Checkebox - checked property
A checkbox is a simple element of the form object.
The key property of a checkbox object is wether or not the box is checked.
The checked property is a boolean value: true is checked , false is not.
Code:
<html>
<head>
<title>
Checkbox
</title>
<script type=”text/javascript”>
function myfunction()
{
if(document.myform.mycheckbox.checked)
{
alert(”The box is checked”);
}
else
{
alert(”The box is not checked”);
}
}
</script>
</head>
<body>
<form name=”myform” onSubmit=”return false”>
<input type=”checkbox” name=”mycheckbox” onClick=”myfunction();” />
</form>
</body>
</html>
Leave a Reply
You must be logged in to post a comment.
