TShopping

 找回密碼
 註冊
搜索
查看: 1991|回復: 1
打印 上一主題 下一主題

[教學] 文字式日期顯示

[複製鏈接]
跳轉到指定樓層
1#
發表於 2008-9-23 23:12:38 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
將下列原始碼複製後貼在 body 和 /body 之間
  1. <p align="center"><font SIZE="2" COLOR="#a00000"><b><script Language="JavaScript"> <!-- function visitor() { //define variable var Jsay; var Jdayr; var Jtoday= new Date(); var Jyear= Jtoday.getYear(); Jmonth=Jtoday.getMonth(); Jday= Jtoday.getDay(); Jdate=Jtoday.getDate(); Jhrs= Jtoday.getHours(); Jmin=Jtoday.getMinutes(); Jsec=Jtoday.getSeconds(); if (Jhrs<12) document.write("<font color=red>早安</font>"); else if ( Jhrs<18) document.write("<font color=red>午安</font>"); else document.write("<font color=red>晚安</font>"); document.write('\t'+'! '); document.write('<font color="#0000ff">今天是<font color=blue>' + (Jmonth+1) ); document.write("</font>月<font color=blue>"+Jdate+"</font>日"); if (Jday==1) document.write("星期<font color=blue>一</font>"); else if (Jday==2) document.write("星期<font color=blue>二</font>"); else if (Jday==3) document.write("星期<font color=blue>三</font>"); else if (Jday==4) document.write("星期<font color=blue>四</font>"); else if (Jday==5) document.write("星期<font color=blue>五</font>"); else if (Jday==6) document.write("星期<font color=red>六</font>"); else if (Jday==0) document.write("星期<font color=red>日</font>"); } visitor(); // --> </script> 時間<script Language="JavaScript"> <!-- //define variable var Jsay; var Jdayr; var Jtoday= new Date(); var Jyear= Jtoday.getYear(); Jmonth=Jtoday.getMonth(); Jday= Jtoday.getDay(); Jdate=Jtoday.getDate(); Jhrs= Jtoday.getHours(); Jmin=Jtoday.getMinutes(); Jsec=Jtoday.getSeconds(); document.write('<font color=blue>'+Jhrs+':'+Jmin+'</font>分'); //--> </script> </b></font></p>
複製代碼

演示
晚安 ! 今天是923日星期 時間 23:1


 

臉書網友討論
*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-4-27 00:49 , Processed in 0.042204 second(s), 18 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表