【发布时间】:2011-04-29 04:42:12
【问题描述】:
我想创建并显示一个每秒以固定数量增加的值。
我的 PHP 文件中有以下变量:
$AccountValue=220000; $IncreasePerSecond=15;
因此,例如,当页面加载时,一秒钟后该值将是 220000,另一秒钟后该值将是 220015 220030 ....etc
提前致谢
【问题讨论】:
我想创建并显示一个每秒以固定数量增加的值。
我的 PHP 文件中有以下变量:
$AccountValue=220000; $IncreasePerSecond=15;
因此,例如,当页面加载时,一秒钟后该值将是 220000,另一秒钟后该值将是 220015 220030 ....etc
提前致谢
【问题讨论】:
这不是完整的答案,但它应该为您提供基础:
var count = 0;
setIncrement("doSomething()", 1000);
function doSomething()
{
document.getElementById("my_div").innerHTML = ++count;
}
见http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
【讨论】: