<html>
<head>
<base href="<%=basePath%>">
<title>全选时选中所有水果</title>
<script type="text/javascript">
function checkAll()
{
for(var i=0;i<document.getElementsByName("selectFlag").length;i++)
{
document.getElementsByName("selectFlag")[i].checked=document.getElementsByName("ifAll")[0].checked;
}
}
</script>
</head>
<body>
<input type="checkbox" name="selectFlag" value="1">苹果<br>
<input type="checkbox" name="selectFlag" value="2">枯子<br>
<input type="checkbox" name="selectFlag" value="3">香蕉<br>
<input type="checkbox" name="selectFlag" value="4">葡萄<br>
<input type="checkbox" name="selectFlag" value="5">桃子<br>
<input type="checkbox" name="ifAll" οnclick="checkAll()" >全选<br>
</body>
</html>