0 0 0

根据时间显示不同的问候语

酋长
23-11-30 2878
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>根据时间不同的问候方式</title>
<script language="javascript">
  today=new Date();
  function initArray(){
       this.length=initArray.arguments.length
       for(var i=0; i< this.length;i++)
       this[i+1]=initArray.arguments[i]
  }
   var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
   document.write("<font color=##000000 style='font-size:9pt;font-family:宋体'>",
   "今天是:",
   today.getYear(),"年",
   today.getMonth()+1,"月",
   today.getDate(),"日",
   d[today.getDay()+1],
   "</font>"
   );
</script>
<!--<script language="JavaScript">
 var mess="";
 document.write("<center><b>")
 day = new Date( )
 hr = day.getHours( )
 if (( hr >= 0 ) && (hr <= 4 ))
 mess="深夜了,注意身体哦... "
 if (( hr >= 4 ) && (hr < 7))
 mess="清晨好,起得真早啊... "
 if (( hr >= 7 ) && (hr < 12))
 mess="早上好,女士们,先生们!"
 if (( hr >= 12) && (hr <= 13))
 mess="午饭时间,别太为难自己的肚子哦!"
 if (( hr >= 13) && (hr <= 17))
 mess="外面的太阳猛烈吗?还是呆在家里舒服吧? "
 if (( hr >= 17) && (hr <= 18))
 mess="进入傍晚了,不想去散散步吗?"
 if ((hr >= 18) && (hr <= 19))
 mess="我大概在吃晚饭了,你呢?"
 if ((hr >= 19) && (hr <= 23))
 mess="又到晚上黄金上网时间了,你还等什么?"
 document.write(mess)
 document.write("</b></center>")
 </script>-->
 
<!--<script language="javascript">
 <!--
 now = new Date(),hour = now.getHours()
 if(hour < 6){document.write("凌晨好!")}
 else if (hour < 9){document.write("早上好!")}
 else if (hour < 12){document.write("上午好!")}
 else if (hour < 14){document.write("中午好!")}
 else if (hour < 17){document.write("下午好!")}
 else if (hour < 19){document.write("傍晚好!")}
 else if (hour < 22){document.write("晚上好!")}
 else {document.write("夜里好!")}
 
 </script>-->
</head>
 <body>
</body>
</html>
展开全文
『Ta』们也感兴趣 (1)
  • 轩逸

请先登录后发表评论!

最新回复 (0)

    暂无评论

返回
请先登录后发表评论!