效果图
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
window.onload = function(){
selAll = document.getElementById("selAll");
hobbys = document.getElementsByName("hobby");
fx = document.getElementById("fx");
//全选事件
selAll.onclick = function(){
//全选
if(selAll.checked == true){
for (var i=0;i<hobbys.length;i++) {
hobbys[i].checked = true;
}
}else{
for (var i=0;i<hobbys.length;i++) {
hobbys[i].checked = false;
}
}
}
//反选
fx.o