html怎么寫星期類型?
var today = new Date(); //新建一個Date對象 var date = today.getDate();//查詢當月日期 var day = today.getDay();//查詢當前星期幾 var month = today.getMonth()+1;//查詢月份 var year = today.getFullYear();//查詢年份 var hour=today.getHours(); var morning=""; if (hour>=8 & hour<=12) morning="上午好"; var week=""; if (day==0) week='星期日'; if (day==1) week='星期一'; if (day==2) week='星期二'; if (day==3) week='星期三'; if (day==4) week='星期四'; if (day==5) week='星期五'; if (day==6) week='星期六'; document.write(year+"年"+month+"月"+date+"日 "+week+" "+morning);
上一篇v開頭的搜索引擎