Javascript sleep 函数
此函数仅适合在10秒内 sleep(5) 超过10秒CPU 会吃不消
<script type="text/javascript"> function sleep(seconds) { this.date = Math.round(new Date().getTime()/1000); while(1) { if(Math.round(new Date().getTime()/1000) - this.date >= seconds) break; } return true; } sleep(5); alert(1); </script>