<html>
<body>
<span>look this:</span><span id="nums">10000</span>
</body>
</heml>
<script type="text/javascript">
var totalNum = 10000;
var nums = 0;
// 调用计时函数
setTimeout(timedCount(nums),50);
// 循环计时函数, 多次调用自身函数, nums为被传递的参数
function timedCount(nums){
var count = Math.round(totalNum/97);
nums = nums+count;
document.getElementById('nums').innerHTML =nums
// $("#nums").text(nums);
// 设置条件使停止计时
if (nums<totalNum) {
setTimeout(function(){timedCount(nums)},50);
}else{
document.getElementById('nums').innerHTML =totalNum
}
}
</script>