1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<script>
window.onload = function() {
sleep(5000);
alert("OK");
}
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
</script>
Post
Cancel
JS实现Sleep函数
This post is licensed under
CC BY 4.0
by the author.