How to use the checked property?
How to use the checked property?
Rating:
The syntax of using the checked property is as follows:
document.formname.radiobuttonname.checked=value
The value should be either true or false, this will check or uncheck the checkbox.
The following example will demonstrate the use of the checked property:
<head>
<script language="JavaScript">
function checkme()
{
document.form1.check1.value.checked=true
}
function uncheckme()
{
document.form1.check1.value.checked=false
}
</script>
</head>
<body>
<form name="form1">
<input type="checkbox" name="check1">
<input type="button" value="Check Me" onclick="checkme()">
<input type="button" value="Uncheck Me" onclick="uncheckme()">
</form>
</body>
<html>
Rating:
Other articles
- What is the bgColor property?
- What is the getElementById() method?
- What is the onreset event handler?
- What is the document object?
- What is the Image object?