关于js全选我着哪错了
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html
charset=utf-8"/>
<script>
window.onload=function ()
{
var oBtn1=document.getElementById('btn1');
var oDiv=document.getElementById('div1');
var aCh=oDiv.getElementsTagName('input');
oBtn1.onclick=function ()
{
for(var i=0;i<aCh.length;i++)
{
aCh[i].checked=true;
}
};
};
</script>
</head>
<body>
<input id="btn1" type="button" value="全选"><br />
<div id="div1">
<input type="checkbox"><br />
<input type="checkbox"><br />
<input type="checkbox"><br />
</div>
</body>
</html>