 
		慕粉3686312
2016-08-05 23:54
function checkone(){
            var j=document.getElementById("wb").value;
            if(parseInt(j)<6&&parseInt(j)>1){
        document.getElementById("hobby"+j).checked=true;}
         // 任务3
        
        }任务三怎么输出不了啊
 
				function checkone(){
            var j=document.getElementById("wb").value;
            var hobby = document.getElementById("hobby"+j);
            hobby.checked = true;    } 
但不是很明白“hobby”+j  。
 
				可以啊,不过if里面的两个数得改成7和0,文本框中输入的数值才是1-6。
function checkone(){
var j=document.getElementById("wb").value;
if(parseInt(j)<7 && parseInt(j)>0){
document.getElementById("hobby"+j).checked=true;
}
}
 
				j是字符串,字符串与字符串是不能相加的
 
				不清楚
JavaScript进阶篇
469062 学习 · 22582 问题
相似问题