function checkone(){
var hobby = document.getElementsByName("hobby");
var j=document.getElementById("wb").value;
// 任务3
var arr=["音乐","登山","游泳","阅读","打球","跑步"];
if(j<=hobby.length&&j>0){
var num=hobby[j-1].id.charAt(hobby.length-1);
//alert(num+arr[2]);
switch(j){
case num:alert(arr[j-1]);break;
default:
alert("请输入正确的选择项!");
}
}else{
alert("请输入正确的选择项!");
}
}
还不错,加油!