checkbox选中问题

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<script 搜索language="javascript">

function selected() {   

var allsel=document.getElementsByName("car");   

for(var i=0;i<allsel.length;i++)   

{    allsel[i].checked=!allsel[i].checked;    }

}

</script>

</head>
<body>

<h1>全选/全不选</h1> 全选/取消<br />

<input type="checkbox" id="sel" name="sel" value="yes" onclick="selected()"> <br/>

<input type="checkbox" id="car" name="car" value="two">aa<br/>

<input type="checkbox" id="car" name="car" value="three">bb<br/> <input type="checkbox" id="car" name="car" value="four">cc<br/> </body> </html>

posted @ 2013-11-04 23:30  明济安  阅读(194)  评论(0编辑  收藏  举报