二亩地专业建站/网站制作建设公司

标题: 日期时间代码 [打印本页]

作者: admin    时间: 2013-11-23 16:44:45     标题: 日期时间代码

  1. <div class="time">
  2. <script type="text/javascript">
  3. today=new Date();
  4. var day; var date; var hello;
  5. hour=new Date().getHours()
  6. if(hour < 6)hello='  凌晨好! '
  7. else if(hour < 9)hello=' 早上好! '
  8. else if(hour < 12)hello=' 上午好! '
  9. else if(hour < 14)hello=' 中午好! '
  10. else if(hour < 17)hello=' 下午好! '
  11. else if(hour < 19)hello=' 傍晚好! '
  12. else if(hour < 22)hello=' 晚上好! '
  13. else {hello='夜深了! '}
  14. var webUrl = webUrl;
  15. document.write(' '+hello);
  16. </script>
  17. <span id=localtime>


  18. <script type="text/javascript">
  19.  today=new Date(); var tdate,tday, x,year; var x = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五","星期六");
  20.   var MSIE=navigator.userAgent.indexOf("MSIE");
  21.   if(MSIE != -1)
  22.    year =(today.getFullYear());
  23.   else
  24.    year = (today.getYear()+1900);
  25.   tdate= year+ "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日" + " " + x[today.getDay()];
  26.   document.write(tdate);
  27. //-->
  28. </script>
  29. </span>
  30. </div>
复制代码







欢迎光临 二亩地专业建站/网站制作建设公司 (http://www.ermudi.cn/) Powered by Discuz! X2