读书人

关于调用服务器时间解决方案

发布时间: 2012-01-29 21:39:32 作者: rapoo

关于调用服务器时间
function comt() {
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hours = now.getHours();
var mins = now.getMinutes();
var secs = now.getSeconds();
var timeVal = " ";
timeVal += year + "- " + month + "- " + date+ " "+hours;
timeVal += ((mins < 10) ? ":0 " : ": ") + mins;
timeVal += ((secs < 10) ? ":0 " : ": ") + secs;
document.form1.completed_time.value = timeVal;
}

为什么我这样它调用的是本地时间呢~~我需要它调用服务器时间啊

[解决办法]
javascript是本地执行的
当然要调用本地时间
[解决办法]
关注下

读书人网 >Java Web开发

热点推荐