<html>
<head>
<meta charset="utf-8">
<meta name="description" content="this" />
<meta name="keywords" content="this" />
<title>this</title>
<script type="text/javascript" src="jquery.js"></script>
<!-- 引入我本地jquery文件http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js-->
<script type="text/javascript">
$(function() {
function initial(num,initial,time) {
var time = time;
var oldnum = 3600*time/1000;
var o = $('.num')
var start_Date= new Date(initial);
var sec = (new Date().getTime()-start_Date.getTime())/oldnum;
var nowNum = parseInt(sec + num);
setInterval(function(){++nowNum;o.html(nowNum)},time)
};
initial (1800,'2017/6/12 15:00',1000);
// 初始数值,初始日期,增加数值间隔(ms)
})
</script>
</head>
<body>
<span class="num">50</span>
</body>
</html>
jq实现数字随时间增加
最新推荐文章于 2021-11-18 15:40:19 发布