代码示例:(标识:dhtm_form_selectall)
<html>
<head>
<script type="text/javascript">
function makeCheck(thisForm)
{
for (i = 0; i < thisForm.option.length; i++)
	{
	thisForm.option[i].checked=true
	}
}

function makeUncheck(thisForm)
{
for (i = 0; i < thisForm.option.length; i++)
	{
	thisForm.option[i].checked=false
	}
}
</script>
</head>
<body>

<form name="myForm">
<input type="button" value="选取" onclick="makeCheck(this.form)">
<input type="button" value="取消" onclick="makeUncheck(this.form)">
<br />
<input type="checkbox" name="option">苹果<br />
<input type="checkbox" name="option">桔子<br />
<input type="checkbox" name="option">香蕉<br />
<input type="checkbox" name="option">西瓜
</form>

</body>
</html>
运行结果: