我将其编程为在一段时间内显示一些图像。它应该从美国东部时间12月2日午夜到美国东部时间12月3日午夜显示。当我在12月2日的午夜检查时它正在工作,当我今天早上检查它已经死了。你能告诉我我的错误在哪里吗?
<script type="text/javascript">
var banner = new Array();
banner[0] = "";
banner[1] = "";
banner[2] = "";
banner[3] = "";
banner[4] = "";
banner[5] = "";
banner[6] = "";
var d = new Date();
if ((d.getUTCDate() >= 2 && d.getUTCHours() >= 5) && (d.getUTCDate() <= 4 && d.getUTCHours() <=5))
{
document.write(banner [0], banner [1], banner [6], banner [5])}
else
{
document.write(banner [6], banner [5], banner [4], banner[1])
}
</script>
答案 0 :(得分:0)
(d.getUTCDate()&gt; = 2&amp;&amp; d.getUTCHours()&gt; = 5)指的是12/2 5:00 am到12/3 0:00 am
(d.getUTCDate()&lt; = 4&amp;&amp; d.getUTCHours()&lt; = 5)指12/4 0:00 am到12/4 5:00 am
12/3 0:00 am到12/4 0:00失踪,
因此:
var banner = new Array();
banner[0] = "0";
banner[1] = "1";
banner[2] = "2";
banner[3] = "3";
banner[4] = "4";
banner[5] = "5";
banner[6] = "6";
var d = new Date();
if ((d.getUTCDate() == 3)||(d.getUTCDate() >= 2 && d.getUTCHours() >= 5) && (d.getUTCDate() <= 4 && d.getUTCHours() <=5))
{
document.write(banner [0], banner [1], banner [6], banner [5])}
else
{
alert(d.getUTCHours())
document.write(banner [6], banner [5], banner [4], banner[1])
}