HTML and CSS Reference
In-Depth Information
Table 11.20 Methods of the checkbox Object
Method
What It Does
blur()
Removes focus from the checkbox.
click()
Simulates a mouse being clicked in the checkbox.
focus()
Puts focus in the checkbox.
handleEvent()
Invokes the handler for a specified event (JavaScript 1.2).
unwatch()
Turns off the watch for a particular property.
watch()
Watches, and when a property is changed, calls a function.
EXAMPLE 11.25
<html>
<head><title>Checkboxes</title>
<script type="text/javascript">
1
function check(f){
var str="";
2
for (var i = 0; i < f.topping.length;i++){
3
if(f.topping[i].checked){
4
str += f.topping[i].value + "\n";
}
}
5
f.order.value=str ;
// Put str value into the text area
}
6
function OK(myForm) {
var result= confirm("Are you sure you
are ready to order? ");
if(result == true){
7
document.myForm.submit();
}
else { return false;}
}
</script>
</head>
<body bgColor="#CCFF33">
<font face="verdana">
<table border="2">
<tr><td><b>Checkboxes</b></td></tr>
</table>
Continues
 
Search WWH ::




Custom Search