qq_潘虫虫虫虫虫虫_03313943
2016-05-22 15:18
var ho=document.getElementsByName("hobby"); switch(j){ case 1: ho[0].checked=true; break; ase 2: ho[1].checked=true; break; case 3: ho[2].checked=true; break; case 4: ho[3].checked=true; break; case 5: ho[4].checked=true; break; case 6: ho[5].checked=true; break; default: }
switch(j) { case "1": var hobby = document.getElementById("hobby1"); if (false == hobby.checked) { hobby.checked = true; } break; case "2": var hobby = document.getElementById("hobby2"); if (false == hobby.checked) { hobby.checked = true; } break; case "3": var hobby = document.getElementById("hobby3"); if (false == hobby.checked) { hobby.checked = true; } break; case "4": var hobby = document.getElementById("hobby4"); if (false == hobby.checked) { hobby.checked = true; } break; case "5": var hobby = document.getElementById("hobby5"); if (false == hobby.checked) { hobby.checked = true; } break; case "6": var hobby = document.getElementById("hobby6"); if (false == hobby.checked) { hobby.checked = true; } break; default: var j = document.getElementById("wb"); j.value=""; j.placeholder="请输入1-6之间的数字"; alert("请输入1-6之间的数字"); break; }
当然可以了。
ase 2 这里少了一个子母C
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题