这是我的代码,
<script type="text/javascript">
function today(hour, minute) {
var now = new Date();
now.setHours(hour);
now.setMinutes(minute);
now.setSeconds(0);
now.setMilliseconds(0);
return now.getTime();
}
var now = new Date();
now = now.getTime();
if(
(now > today(11, 45) && now < today(14, 00)) ||
(now > friday(19, 00) && now < saturday(0, 00))
) {
alert("Lunchtime Specials!");
window.location = "http://google.ie";
}</script>
它适用于“今天”,但不适用于周五或周六等有什么建议吗?