嘿傢伙,所以我需要幫助搞清楚我的JavaScript代碼中的錯誤是什麼。
調試生成圖像的javascript代碼
我確切知道代碼停止工作的位置,但我無法弄清楚問題所在。誰能幫忙?
function createCardio(){
var randomimages=new Array();
randomimages[0]="images/strength/armcircles.gif";
randomimages[1]="images/strength/calfraises.gif";
/**add more images**/
var preload=new Array()
for (n=0;n<randomimages.length;n++){
preload[n]=new Image()
preload[n].src=randomimages[n]
}
if(document.getElementById("impact").checked == false && document.getElementById("pregnant").checked == false && document.getElementById("none").checked == false){
document.getElementById("error").innerHTML = "*All fields are required";
}
else if(document.getElementById("beginner").checked == false && document.getElementById("intermediate").checked == false && document.getElementById("advanced").checked == false){
document.getElementById("error").innerHTML = "*All fields are required";
}
else if(document.getElementById("hiit").checked == false && document.getELementById("tabata").checked == false && document.getElementById("circuit").checked == false){
document.getElementById("error").innerHTML = "*All fields are required";
}
else if(document.getElementById("treadmill").checked == false && document.getElementById("bike").checked == false && document.getElementById("jump").checked == false && document.getElementById("equipment").checked == false){
document.getElementById("error").innerHTML = "*All fields are required";
}
else{
if(document.getElementById("equipment").checked == true){
if(document.getElementById("hiit").checked == true){
if(document.getElementById("impact").checked == true && document.getElementById("pregnant").checked == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Perform each exercise for 40 seconds, followed by 20 seconds of rest (10 min)";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
}
else if(document.getElementById("impact") == true){
if(document.getElementById("beginner").checked == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Perform each exercise for 40 seconds, followed by 20 seconds of rest (10 min)";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[43]+'" width=40% height=40%>';
}
else{
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Perform each exercise for 40 seconds, followed by 20 seconds of rest (10 min)";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
}
}
else if(document.getElementById("pregnant") == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Perform each exercise for 40 seconds, followed by 20 seconds of rest (10 min)";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
}
else{
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Perform each exercise for 40 seconds, followed by 20 seconds of rest (10 min)";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
}
}
這是代碼停止工作
else if(document.getElementById("tabata").checked == true){
if(document.getElementById("impact").checked == true && document.getElementById("pregnant").checked == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Perform each exercise for 20 seconds, followed by 10 seconds of rest (10 min)Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
}
else if(document.getElementById("impact") == true){
if(document.getElementById("beginner").checked == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[43]+'" width=40% height=40%>';
}
else{
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
}
}
else if(document.getElementById("pregnant") == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
}
else{
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
}
}
else{
if(document.getElementById("impact").checked == true && document.getElementById("pregnant").checked == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
}
else if(document.getElementById("impact") == true){
if(document.getElementById("beginner").checked == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*36)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[43]+'" width=40% height=40%>';
}
else{
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*44)]+'" width=40% height=40%>';
}
}
else if(document.getElementById("pregnant") == true){
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(52-43)+43)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*15)]+'" width=40% height=40%>';
}
else{
document.getElementById("input").innerHTML = " ";
document.getElementById("perform").innerHTML = "Complete 3 rounds of 15-20 reps for each move";
document.getElementById("img1").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img2").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img3").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img4").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img5").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img7").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img8").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img9").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
document.getElementById("img10").innerHTML = '<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*56)]+'" width=40% height=40%>';
}
}
}
}
}
哪裏能忘記,我看到了嗎? –
get_EL_ementById – hank
_「停止工作」_它如何停止工作?你會得到錯誤嗎,代碼是否有點奇怪? –