mardi 20 juin 2017

prompt number that scrolls with loop using if and else

I'm trying to insert a number in a prompt and scroll the screen using a for loop with if and else statements, and not success.

This is not even my best shot:

function off() {
var ik = prompt("type a number from 1 to 1000");
for(var i=0;i<1000;i++){
if(ik == i){
window.scrollTo(1366*i, 0);
break;
}else{alert("");}
}; };

Aucun commentaire:

Enregistrer un commentaire