当前位置: 技术问答>java相关
在线高分求助:jsp中如何实现动态时间显示???
来源: 互联网 发布时间:2017-05-01
本文导语: jsp中如何实现动态时间显示??? | 这是我根据别人的脚本改的,看看吧 var timerID = null; var timerRunning = false; function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false;} function startclo...
jsp中如何实现动态时间显示???
|
这是我根据别人的脚本改的,看看吧
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
function startclock () {
stopclock();
showtime();}
function showtime () {
var now = new Date();
document.clock.thetime.value = now.toString();
timerID = setTimeout("showtime()",1000);
timerRunning = true;}
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
function startclock () {
stopclock();
showtime();}
function showtime () {
var now = new Date();
document.clock.thetime.value = now.toString();
timerID = setTimeout("showtime()",1000);
timerRunning = true;}
|
用javascript实现吧,jsp不好.
|
The current time is
你在这个代码前面增加一个设置相关的属性,让页面不停的刷新就可以了