關(guān)于任務(wù)三的小問題??!
function?checkone(){ ????????????var?j=document.getElementById("wb").value; ????????????if(parseInt(j)<6&&parseInt(j)>1){ ????????document.getElementById("hobby"+j).checked=true;} ?????????//?任務(wù)3 ???????? ????????}
任務(wù)三怎么輸出不了啊
2016-08-13
function checkone(){
? ? ? ? ? ? var j=document.getElementById("wb").value;
? ? ? ? ?? ?var hobby = document.getElementById("hobby"+j);
? ? ? ? ?? ?hobby.checked = true;? ? }
但不是很明白“hobby”+j? 。
2016-08-11
可以啊,不過if里面的兩個(gè)數(shù)得改成7和0,文本框中輸入的數(shù)值才是1-6。
function checkone(){
? ? ? ? ? ? var j=document.getElementById("wb").value;
? ? ? ? ? ? if(parseInt(j)<7 && parseInt(j)>0){
? ? ? ? ? document.getElementById("hobby"+j).checked=true;
? ? ? ? ? }
? ? ? ? ? ? }
2016-08-06
j是字符串,字符串與字符串是不能相加的
2016-08-06
不清楚