1个回答
推荐于2016-07-29
展开全部
<div id="counter"></div>
<script>
var counter = document.getElementById("counter");
function count(){
var time = 50;
counter.innerHTML = time;
var timer = setInterval(function(){
time--;
counter.innerHTML = time;
if(time==0){
alert("游戏结束");
clearInterval(timer);
}
},1000);
}
count();
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询