萬盛學電腦網

 萬盛學電腦網 >> 網頁制作 >> Html5 >> html5帶問候語的時間顯示的方法介紹

html5帶問候語的時間顯示的方法介紹

下面我們給大家介紹一下html5帶問候語的時間顯示的方法吧!希望大家可以在這裡學習!

<script language="Javascript">
  <!-----------
  var enabled = 0;   today = new Date();
  var day;   var date;
  if(today.getDay()==0)     day = "星期日"
  if(today.getDay()==1)     day = "星期一"
  if(today.getDay()==2)     day = "星期二"
  if(today.getDay()==3)     day = "星期三"
  if(today.getDay()==4)     day = "星期四"
  if(today.getDay()==5)     day = "星期五"
  if(today.getDay()==6)     day = "星期六"
  document.fgColor = " FF0072";
  date1 = "<font size=2 color=red>" + (today.getYear())  + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日  " + "</font>";
  date2 = "<font size=1 color=red>" +  day + "</font>";
  document.write("<center>" + date1.fontsize(3) + date2.fontsize(3) + "</center>");
  //----->
  </script>
  <script language="Javascript">
  <!--
  document.write("<center><font color=#0066ff size=+1> ")
  day = new Date()
  hr = day.getHours()
  if (hr ==1)
  document.write("凌晨一點已過,別忘了休息喔!")
  if (hr ==2)
  document.write("該休息了,身體可是革命的本錢啊!")
  if (hr ==3)
  document.write("夜深人靜,只有你敲擊鼠標的聲音...")
  if (hr ==4)
  document.write("四點過了,你明天不上班???")
  if (hr ==5)
  document.write("該去晨運了!!!")
  if (hr ==6)
  document.write("你知道嗎,此時是國內網絡速度最快的時候!")
  if (hr ==7)
  document.write("新的一天又開始了,祝你過得快樂!")
  if ((hr ==8) || (hr == 9) || (hr ==10))
  document.write("上午好!今天你看上去好精神哦!")
  if (hr ==11)
  document.write("十一點過了,快下班了吧?")
  if (hr ==12)
  document.write("十二點過了,還不下班?")
  if ((hr==13) || (hr==14))
  document.write("你不睡午覺?")
  if ((hr==15) || (hr==16) || (hr==17))
  document.write("下午好!")
  if ((hr==18) || (hr==19))
  document.write("吃晚飯了吧?")

copyright © 萬盛學電腦網 all rights reserved