danny 2007-12-7 10:13
精緻的日期顯示
[code]<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></Body>[/code]