案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function makeCheck(thisForm)
5
{
6
for (i = 0; i < thisForm.option.length; i++)
7
    {
8
    thisForm.option[i].checked=true
9
    }
10
}
11
12
function makeUncheck(thisForm)
13
{
14
for (i = 0; i < thisForm.option.length; i++)
15
    {
16
    thisForm.option[i].checked=false
17
    }
18
}
19
</script>
20
</head>
21
<body>
22
23
<form name="myForm">
24
<input type="button" value="选取" onclick="makeCheck(this.form)">
25
<input type="button" value="取消" onclick="makeUncheck(this.form)">
26
<br />
27
<input type="checkbox" name="option">苹果<br />
28
<input type="checkbox" name="option">桔子<br />
29
<input type="checkbox" name="option">香蕉<br />
30
<input type="checkbox" name="option">西瓜
31
</form>
32
33
</body>
34
</html>
35