Microsoft JScript 运行时错误: 'document.getElementById(...)' 为空或不是对象
<scripttype="text/javascript"language="javascript">varnow,urodz;varsDate='<%=sysDate(...
<script type="text/javascript" language="javascript">
var now, urodz;
var sDate = '<%=sysDate() %>';
var eDate = '<%=ExamEndTime() %>';
now = new Date(Date.parse(sDate.replace(/-/g, "/")));
urodz = new Date(Date.parse(eDate.replace(/-/g, "/")));
function GetServerTime() {
now.setTime(now.getTime() + 250);
days = (urodz - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (urodz - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (urodz - now) / 1000 / 60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (urodz - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
if (hoursRound < 10)
hoursRound = "0" + hoursRound;
if (minutesRound < 10)
minutesRound = "0" + minutesRound;
if (secondsRound < 10)
secondsRound = "0" + secondsRound;
document.getElementById("Span1").innerHTML = "" + hoursRound + ":" + minutesRound + ":" + secondsRound + "";
}
setInterval("GetServerTime()", 250);
</script>
document.getElementById("Span1").innerHTML = "" + hoursRound + ":" + minutesRound + ":" + secondsRound + "";————这行报错 展开
var now, urodz;
var sDate = '<%=sysDate() %>';
var eDate = '<%=ExamEndTime() %>';
now = new Date(Date.parse(sDate.replace(/-/g, "/")));
urodz = new Date(Date.parse(eDate.replace(/-/g, "/")));
function GetServerTime() {
now.setTime(now.getTime() + 250);
days = (urodz - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (urodz - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (urodz - now) / 1000 / 60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (urodz - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
if (hoursRound < 10)
hoursRound = "0" + hoursRound;
if (minutesRound < 10)
minutesRound = "0" + minutesRound;
if (secondsRound < 10)
secondsRound = "0" + secondsRound;
document.getElementById("Span1").innerHTML = "" + hoursRound + ":" + minutesRound + ":" + secondsRound + "";
}
setInterval("GetServerTime()", 250);
</script>
document.getElementById("Span1").innerHTML = "" + hoursRound + ":" + minutesRound + ":" + secondsRound + "";————这行报错 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询