我有以下功能:
<script>
var count=900;
var countM;
var counter=setInterval(timer, 1000); //1000 will run it every 1 second
function timer()
{
count=count-1;
countM=Math.floor(count/60);
if (count <= 0)
{
clearInterval(counter);
return;
}
for(var i=0; i<10; i++)
{
document.getElementById("timer"+i).innerHTML=countM+"mins. "+(count%60)+ " secs"; // watch for spelling
}
}
</script>
我这样显示它:
<span id="<?php echo "timer".$theCounter; ?>"></span>
$theCounter++;
问题在于我想给它一个参数,这将是count
我不知道该怎么做。