<html>
<head>
<title>全选</title>
<script type="text/javascript" language="javascript">
function checkall(asr){
var like=document.getElementsByName("like[]");
for(var i=0;i<like.length;i++){
like[i].checked=asr.checked;
}
}
</script>
</head>
<body>
你喜欢的动漫
<form>
<input type="checkbox" name="like" onClick="checkall(this)">全选
<input type="checkbox" name="like[]">火影忍者
<input type="checkbox" name="like[]">灌篮高手
<input type="checkbox" name="like[]">多啦A梦
<input type="checkbox" name="like[]">宠物精灵
</form>
</body>
</html>
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/98514.html