/p>
Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd">
无标题文档
window.onload = function getTime(){
var st = showtime();
//对文本框赋值
document.getElementByIdx_x("clock").value = st;
}
function showtime()
{
today=new Date();
var year=today.getYear();
var month=today.getMonth()+1;
var day=today.getDate();
var hours=today.getHours();
var minutes=today.getMinutes();
var seconds=today.getSeconds();
var timeValue= year;
timeValue += ((month < 10) ? "-0" : "-") +
month+"";
timeValue += ((day < 10) ? "-0" : "-") +
day+"";
timeValue += ((hours < 12) ? "-0" : " ") +
hours+"";
timeValue += ((minutes < 10) ? "-0" : ":") +
minutes+"";
timeValue += ((seconds < 10) ? "-0" : ":") +
seconds+"";
return timeValue;
}
/>