windows 设置刷新时间

Window setInterval() Method

自动增长。javascript

http://www.w3schools.com/jsref/met_win_setinterval.aspjava

While loading the page get the server time in long and create a Date(millis) Object with Javascript.jsp

Then use setInterval() with 1 sec and display.spa

In you Jspcode

var jsVar=  <% dateMillis %>;   // server millis

and javascript date formationorm

var d = new Date();
d.setTime(jsVar);   // server millis ex :1332403882588

Then show in JSserver

var x = document.getElementById("timelable");
x.innerHTML=d.getMilliseconds(); // Modify as per your format

Thenip

window.setInterval(Yourfunction,milliseconds);##"function_name" 须要双引号

Then in your Yourfunction add 1 sec to your millis and refresh lableget

参考博文 http://stackoverflow.com/questions/19515138/displaying-server-time-on-jsp-pageit

相关文章
相关标签/搜索