以下是代码片段:
today=new Date();
var hour=today.getHours();
var minute=today.getMinutes();
function initArray()
{
this.length=initArray.arguments.length
for(var i=0;i
this[i+1]=initArray.arguments[i]
}
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
if ( d[today.getDay()+1]=="星期六" || d[today.getDay()+1]=="星期日" )
{
document.write("今天是休息日");
}
else
{
if (hour>=8 && hour<=17)
{
if (minute==30 && hour==8 || hour==17)
{
document.write("不是上班时间");
}
else
{
document.write("上班时间");
}
}
else
{
document.write("不是上班时间");
}
}