woff 發表於 2008-9-23 23:12:38

文字式日期顯示

將下列原始碼複製後貼在 body 和 /body 之間 <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>
演示 晚安 ! 今天是9月23日星期二 時間 23:1分
頁: [1]
查看完整版本: 文字式日期顯示