function checkone(){
var j=document.getElementById("wb").value;
var hobby = document.getElementById("hobby"+j);
hobby.checked = true;
}
其中的 var hobby = document.getElementById("hobby"+j); “hobb”+j是不是等价与"hobbyj”所以括号中不用再加个引号将整个包起来?
不等价, j是变量,例如 j = 3, "hobby"+j - > "hobby3" , 而"hobbyj”还是"hobbyj”
不等价, j是变量,例如 j = 3, "hobby"+j - > "hobby3" , 而"hobbyj”还是"hobbyj”