打印

[asp] 考试时间问题

代码<body onLoad="getTime()" >
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function getTime() {
now =new Date(<%now()%>);

y2k = new Date("2008/6/27 00:00:00")
hours = (y2k - now) / 1000 / 60 / 60
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60  - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000  - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
sec = (secondsRound == 1) ? " second." : " 秒 ";
min = (minutesRound == 1) ? " minute" : " 分 ";
hr = (hoursRound == 1) ? " hour" : " 小时 ";

document.form1.timea.value =   + hoursRound + hr + minutesRound + min + secondsRound + sec;
newtime = window.setTimeout("getTime();", 1000);
}
//  End -->
</script>
<form name="form1" action="test.asp" target="_blank" method="post">
<div align="center"><font color="#FF0000">
  现在计时开始:剩余时间:</font>
    <input type=text name=timea size=20 readonly>
</form>
以上程序没问题.现在想将考试结束时间从数据表读取,即Rs1("endtime"),在页面输出Rs1("endtime")正常,为2008-6-26 11:0:0 .现在想将y2k = new Date("2008/6/27 00:00:00")换成Rs1("endtime").换了后在文本框里没有输出.
谢谢
y2k=Replace("2008/6/27 00:00:00","/","-")
年份=Year(y2k)
月份=Month(y2k)
...

这样不行吗?