JavaScript没有像Java的sleep延时函数,所以记录JavaScript的sleep延时函数
function sleep(milliSeconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliSeconds);
}
sleep(10000);//延时10s
JavaScript没有像Java的sleep延时函数,所以记录JavaScript的sleep延时函数
function sleep(milliSeconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliSeconds);
}
sleep(10000);//延时10s