Check and uncheck a checkbox : CheckBox « Form Control « JavaScript DHTML
- JavaScript DHTML
- Form Control
- CheckBox
Check and uncheck a checkbox
<html>
<head>
<script type="text/javascript">
function check(){
var x=document.forms.myForm
x[0].checked=true
}
function uncheck(){
var x=document.forms.myForm
x[0].checked=false
}
</script>
</head>
<body>
<form name="myForm">
<input type="checkbox" value="on">
<input type="button" onclick="check()" value="Check Checkbox">
<input type="button" onclick="uncheck()" value="Uncheck Checkbox">
</form>
</body>
</html>
Related examples in the same category