Basic Javascript loading message while js processing completes

前端 未结 3 1159
闹比i
闹比i 2021-01-13 04:43

Im sure this has been asked 1000 times before, basically all I want to do is change the content of an element of the page to display a loading message while my other javascr

3条回答
  •  情话喂你
    2021-01-13 05:04

    Your pausecomp(3000) is essentially blocking the browser from redrawing because of the while loop. I would do something like this instead :

    function wasteTime(){
        setTimeout(runNext, 3000);
    }
    
    function runNext(){
         alert("marvelous!");
    }
    

提交回复
热议问题