能否用if语句实现?
<input type="checkbox" name="hobby" id="hobby1"> 音乐
<input type="checkbox" name="hobby" id="hobby2"> 登山
<input type="checkbox" name="hobby" id="hobby3"> 游泳
<input type="checkbox" name="hobby" id="hobby4"> 阅读
<input type="checkbox" name="hobby" id="hobby5"> 打球
<input type="checkbox" name="hobby" id="hobby6"> 跑步 <br>
<input type="button" value = "全选" onclick = "checkall();">
<input type="button" value = "全不选" onclick = "clearall();">
function checkall(){
var hobby = document.getElementsByTagName("input");
/*for(var i=0;i<hobby.length;i++){
hobby[i].checked=true
}*/
//能否用if语句实现筛选?if(name==hobby)?
// 任务1