0
我想在smartry(.tpl)文件中使用此計數器。我已經找到腳本鏈接低於沒有新鮮的JavaScript增量計數器
我只是想知道我是否需要把這些腳本代碼的
var START_DATE = new Date("October 10, 2012 22:30:00"); // put in the starting date here
var INTERVAL = 1; // in seconds
var INCREMENT = 30; // increase per tick
var START_VALUE = 35001; // initial value when it's the start date
var count = 0;
$(document).ready(function() {
var msInterval = INTERVAL * 1000;
var now = new Date();
count = parseInt((now - START_DATE)/msInterval) * INCREMENT + START_VALUE;
document.getElementById('counter').innerHTML = count;
window.setInterval(function(){
count += INCREMENT;
document.getElementById('counter').innerHTML = count;
}, msInterval);
});
我的意思是在哪裏把這些下還是?我想在smarty(.tpl)文件中使用它們。指導我,因爲我是新的JavaScript。