$(function(){
showTime();
});
function getLocalTime(Sj) {
return new Date(Sj).toLocaleString();
}
function showTime(){
var date = new Date();
var t= Date.parse(date);//parse是静态方法 不用创建date对象
document.getElementById("sss").value=getLocalTime(t);
window.setTimeout(showTime,1000);
showTime();
});
function getLocalTime(Sj) {
return new Date(Sj).toLocaleString();
}
function showTime(){
var date = new Date();
var t= Date.parse(date);//parse是静态方法 不用创建date对象
document.getElementById("sss").value=getLocalTime(t);
window.setTimeout(showTime,1000);
}
别忘了 包含 jquery.js 了
本文介绍了一个使用JavaScript和jQuery实现的简单示例,该示例能够实时地更新并显示当前时间。通过定时调用函数更新页面上的时间元素,使得时间显示能够保持最新状态。

被折叠的 条评论
为什么被折叠?



