代码:
<SCRIPT language=JavaScript> var enabled = 0; today = new Date(); var day; var date; if(today.getDay()==0) day = "星期日" if(today.getDay()==1) day = "星期一" if(today.getDay()==2) day = "星期二" if(today.getDay()==3) day = "星期三" if(today.getDay()==4) day = "星期四" if(today.getDay()==5) day = "星期五" if(today.getDay()==6) day = "星期六" document.fgColor = " cadet"; date1 = "<font size=5 face=华文新魏 color=cadet>" + (today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 " + "</font>"; date2 = "<font size=5 face=华文新魏 color=cadet>" + day + "</font>"; document.write("<center>" + date1.fontsize(2) + date2.fontsize(2) + "</center>"); </SCRIPT>
还能改变字体及大小,颜色.
时间显示:
代码:
<script LANGUAGE="JavaScript">
Stamp = new Date(); var Hours; var Mins; var Time; Hours = Stamp.getHours(); if (Hours >= 12) { Time = " P.M."; } else { Time = " A.M."; } if (Hours > 12) { Hours -= 12; } if (Hours == 0) { Hours = 12; } Mins = Stamp.getMinutes(); if (Mins < 10) { Mins = "0" + Mins; } document.write('<font size="5" face="Arial" color=cadet>' + Hours + ":" + Mins + '</font>'); document.write('<font size="3" face="Arial" color=cadet>' + Time + '</font>');
</script>
24时制显示:
代码:
<script LANGUAGE="JavaScript">
Stamp = new Date(); var Hours; var Mins; var Time; Hours = Stamp.getHours(); if (Hours >= 24)
if (Hours > 24) { Hours -= 24; } if (Hours == 0) { Hours = 24; } Mins = Stamp.getMinutes(); if (Mins < 10) { Mins = "0" + Mins; } document.write('<font size="5" face="Arial" color=cadet>' + Hours + ":" + Mins + '</font>');
</script>
24时制带秒走动显示:
代码:
<span id="liveclock" style"=width: 109px; height: 15px"></span> <SCRIPT language=javascript> function www_helpor_net() { var Digital=new Date() var hours=Digital.getHours() var minutes=Digital.getMinutes() var seconds=Digital.getSeconds()
if(minutes<=9) minutes="0"+minutes if(seconds<=9) seconds="0"+seconds myclock="<font size='5' color=cadet>"+hours+":"+minutes+":"+seconds+"</font>" if(document.layers){document.layers.liveclock.document.write(myclock) document.layers.liveclock.document.close() }else if(document.all) liveclock.innerHTML=myclock setTimeout("www_helpor_net()",1000) } www_helpor_net(); //--> </SCRIPT>
|