<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
function selectall()
{
var mycheckbox=document.getElementById('select1');
var checkboxs=document.getElementsByName('aihao');
for(var i=0;i<checkboxs.length;i++)
{
checkboxs[i].checked=mycheckbox.checked;
}
}
</script>
</head>
<body>
爱好 <br />
<input type="checkbox" name="aihao" value="1"/>足球
<input type="checkbox" name="aihao" value="2"/>乒乓球
<input type="checkbox" name="aihao" value="3"/>羽毛球
<input type="checkbox" name="aihao" value="4"/>篮球球
<input type="checkbox" name="aihao" value="5"/>网球 <br />
全选<input type="checkbox" name="select" id="select1" onclick="selectall()"/>
</body>
</html>