Collus
2016-06-29 19:57
我将代码修改成了下面,当倒计时为0 时调用Wopen()这个函数打开一个新网址。但每次倒计时结束后总是无法打开
curShowTimeSeconds = getCurrentShowTimeSeconds()
if(curShowTimeSeconds == 0 ){
Wopen();
}else{
setInterval(
function(){
render( context );
update();
}
,
50
);}
}
function Wopen() {
window.open('http://www.imooc.com','_blank')
}
function getCurrentShowTimeSeconds() {
var curTime = new Date();
var ret = endTime.getTime() - curTime.getTime();
ret = Math.round( ret/1000 )
if(ret==0)
Wopen();
return ret >= 0 ? ret : 0;
}把判断放到getCurrentShowTimeSeconds()里面即可!
炫丽的倒计时效果Canvas绘图与动画基础
96921 学习 · 1029 问题
相似问题