问答详情
源自:8-5 计时器setTimeout()

我想实现无限321的循环,if语句怎么改成for循环

var num=0;

function numCount(){

     document.getElementById('txt').value=num;

    if(num<3){

         num=num+1;

        setTimeout("numCount()",1000);

    }else{

        num=0;

        setTimeout("numCount()",1000);

}

 }


提问者:qq__3259 2018-06-28 16:28

个回答

  • Stupid_and_talent
    2018-06-28 17:05:44

    没有int,用var