<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>javascript数字递增,一秒刷新一次</title>
<script type="text/javascript">
var t = 1000; //在这里设置刷新时间,单位是毫秒,比如1秒钟就是1000
//var min = 20000; //生成的最小的数字,比如200
//var max = 500000; //生成的最大的数字,比如500
var ctl_id = "show"; //要在哪个控件中显示,比如例子中的"show"
var Num = 0;
onload = function() {
Refresh();
setInterval("Refresh();", t);
}
function Refresh() {
Num = Num + 1;
document.getElementById(ctl_id).innerHTML = Num;
}
</script>
</head>
<body>
<div id="show"></div>
</body>
</html>