[removed] How to put a simple delay in between execution of javascript code?

前端 未结 5 1116
你的背包
你的背包 2020-12-16 01:45

I have a for loop which iterates more than 10,000 times in a javascript code. The for loop creates and adds < div > tags into a box in the current page DOM.



        
5条回答
  •  一生所求
    2020-12-16 02:13

    Here is the real trick to put a delay in javascript without hanging the browser. You need to use a ajax function with synchronous method which will call a php page and in that php page you can use the sleep() php function ! http://www.hklabs.org/articles/put-delay-in-javascript

提交回复
热议问题