所以我有一个倒计时器,当时间用完时显示链接...我在javascript中不太好所以需要一些帮助...有没有办法,而不是链接,我可以一旦时间用完就允许.php文件运行?
这是我正在使用的代码。
P.S。如何在倒计时中更改数字的字体呢?
<!--START COUNTDOWN TIMER SCRIPT-->
<br />
<script type="text/javascript">
window.onload = function()
{
countDown('my_div1', '<a href="cdtl.html">Hello 1</a>', 720);
}
function countDown(elID, output, seconds)
{
var elem = document.getElementById(elID),
start = new Date().getTime(), end = start+seconds*1000,
timer = setInterval(function() {
var now = new Date().getTime(), timeleft = end-now, timeparts;
if( timeleft < 0) {
elem.innerHTML = output;
clearInterval(timer);
}
else {
timeparts = [Math.floor(timeleft/60000),Math.floor(timeleft/1000)%60];
if( timeparts[1] < 10) timeparts[1] = "0"+timeparts[1];
elem.innerHTML = "Time left: "+timeparts[0]+":"+timeparts[1];
}
} ,250); // the lower this number, the more accurate the timer. 250 recommended
}
</script>
<center>
<div id="my_div1"></div>
</center>
<!--END COUNTDOWN TIMER SCRIPT-->