87,910
社区成员
发帖
与我相关
我的任务
分享
<div id="prompt1"style="width: 500px;height: 500px;display:none;background-color: #00A1CB">
<p>顶顶顶</p>
</div>
<script>
$(function () {
document.getElementById("prompt1").style.display="block"; //第一行
pauseTime(2000); //第二行
document.getElementById("prompt1").style.display="none";
});
//自己写的暂停毫秒数的函数
function pauseTime(millTime) {
var start=Date.now();
while(true){
var nowTime=Date.now();
var offset=nowTime-start;
if(offset>=millTime)
break;
}
}
</script>
document.getElementById("prompt1").style.display="block"; //第一行
setTimeout(function(){
document.getElementById("prompt1").style.display="none";
},2000) //第二行
function pauseTime(millTime) {
var start=Date.now();
while(true){
var nowTime=Date.now();
var offset=nowTime-start;
if(offset>=millTime)
break;
}
}
console.log(Date.now());
pauseTime(2000);
console.log(Date.now());
正常啊