一、網(wǎng)頁顯示月份、日期、星期代碼
<script language=JavaScript>
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
document.write(
"<font color=##000000 style='font-size:9pt;font-family: 宋體'> ",
today.getYear(),"年",
today.getMonth()+1,"月",
today.getDate(),"日",
d[today.getDay()+1],
"</font>" );
</script>
二、六種風(fēng)格時(shí)間顯示,一定有你喜歡的!
<SCRIPT language="javascript">
<!--
function initArray()
{
for(i=0;i<initArray.arguments.length;i++)
this[i]=initArray.arguments[i];
}
var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;
clck=(hrs>=12)?"下午":"上午";
var stnr="";
var ns="0123456789";
var a="";
function getFullYear(d)
{
yr=d.getYear();if(yr<1000)
yr+=1900;return yr;}
document.write("<table>");
//下面各行分別是一種風(fēng)格,把不需要的刪掉即可
document.write("<TR><TD>風(fēng)格一:</TD><TD>"+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年");
document.write("<TR><TD>風(fēng)格二:</TD><TD>"+clckh+":"+clckm+":"+clcks+""+clck+"</TD></TR>");
document.write("<TR><TD>風(fēng)格三:</TD><TD>"+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年 "+clckh+":"+clckm+":"+clcks+""+clck+"</TD></TR>");
document.write("<TR><TD>風(fēng)格四:</TD><TD>"+(today.getMonth()+1)+"/"+today.getDate()+"/"+(getFullYear(today)+"").substring(2,4)+"</TD></TR>");
document.write("<TR><TD>風(fēng)格五:</TD><TD>"+hrs+":"+clckm+":"+clcks+"</TD></TR>");
document.write("<TR><TD VALIGN=TOP>風(fēng)格六:</TD><TD>"+today+"</TD></TR>");
document.write("</table>");
//-->
</SCRIPT>
三、這個(gè)時(shí)鐘是有影子的,而且還在不停地走著呢
<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:'Arial black';color:#cccccc;font-size:20px;top:50px;left:173px"></div>
<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:'Arial black';color:#000000;font-size:20px;top:48px;left:170px"></div>
<div id="mainbody" style="position:absolute; visibility:visible">
</div>
<script language=javaScript>
<!--
function www_helpor_net() {
thistime= new Date()
var hours=thistime.getHours()
var minutes=thistime.getMinutes()
var seconds=thistime.getSeconds()
if (eval(hours) <10) {hours="0"+hours}
if (eval(minutes) < 10) {minutes="0"+minutes}
if (seconds < 10) {seconds="0"+seconds}
thistime = hours+":"+minutes+":"+seconds
if(document.all) {
bgclocknoshade.innerHTML=thistime
bgclockshade.innerHTML=thistime
}
if(document.layers) {
document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Verdana;color:FFAAAAA;font-size:20px;top:10px;left:152px">'+thistime+'</div>')
document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Verdana;color:DDDDDD;font-size:20px;top:8px;left:150px">'+thistime+'</div>')
document.close()
}
var timer=setTimeout("www_helpor_net()",200)
}
www_helpor_net();
//-->
</script>
四、 數(shù)字化的時(shí)鐘
<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="現(xiàn)在時(shí)刻:<font size='5' face='Arial black'>"+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>
五、動(dòng)態(tài)時(shí)鐘代碼2,此代碼相當(dāng)簡單
<SCRIPT>setInterval("jnkc.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt (new Date().getDay());",1000);
</SCRIPT>
六、flash時(shí)鐘,改變sz1.swf中的1為0、1、2、3、4、5、6,可以獲得不同樣式的時(shí)鐘,你試試吧。
<EMBED SRC=http://www./kjsk/img/sz1.swf WIDTH=99 HEIGHT=99 wmode=transparent quality=high loop=true menu=false>
七、
<SCRIPT language=javascript class="unnamed1">
<!--
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year< 100) year = 1900 + year;
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth--;
var dayname = new Array ("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
var monthname =
new Array ("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月" );
document.write("<font color=006699>"+year +"年");
document.write(monthname[month]);
document.write(date + "日 ");
document.write(dayname[day]+" "+"</font>");
// January(1月份節(jié)日,以下同。)
if ((month == 11) && (date > 25) && (date < 31)) document.write("新的一年快到了");
if ((month == 0) && (date == 1)) document.write("今天是元旦");
if ((month == 0) && (date > 1) && (date < 6)) document.write("主顯節(jié)快到了");
if ((month == 0) && (date == 6)) document.write("今天是主顯節(jié)");
if ((month == 1) && (date > 9) && (date < 14)) document.write("情人節(jié)快到了");
if ((month == 1) && (date == 14)) document.write("今天是情人節(jié)");
if ((month == 2) && (date > 3) && (date < 8)) document.write("國際婦女節(jié)快到了");
if ((month == 2) && (date == 8)) document.write("今天是國際婦女節(jié)");
if ((month == 2) && (date > 8) && (date < 12)) document.write("植樹節(jié)快到了");
if ((month == 2) && (date == 12)) document.write("今天是植樹節(jié)");
if ((month == 2) && (date > 16) && (date < 21)) document.write("世界林業(yè)日快到了");
if ((month == 2) && (date == 21)) document.write("今天是世界林業(yè)日");
if ((month == 2) && (date > 17) && (date < 22)) document.write("復(fù)活節(jié)快到了");
if ((month == 2) && (date == 22)) document.write("今天是復(fù)活節(jié)開始日");
if ((month == 2) && (date > 22)) document.write("復(fù)活節(jié)期間");
if ((month == 2) && (date > 25) && (date < 31)) document.write("愚人節(jié)快到了");
if ((month == 3) && (date == 1)) document.write("今天是愚人節(jié)");
if ((month == 3) && (date > 1) && (date < 5)) document.write("清明節(jié)快到了");
if ((month == 3) && (date == 5)) document.write("今天是清明節(jié)");
if ((month == 3) && (date > 5) && (date < 7)) document.write("世界衛(wèi)生日快到了");
if ((month == 3) && (date == 7)) document.write("今天是世界衛(wèi)生日");
if ((month == 3) && (date > 18) && (date < 23)) document.write("世界氣象日快到了");
if ((month == 3) && (date == 23)) document.write("今天是世界氣象日");
if ((month == 3) && (date < 25)) document.write("復(fù)活節(jié)期間");
if ((month == 3) && (date == 25)) document.write("今天是復(fù)活節(jié)結(jié)束日");
if ((month == 3) && (date > 25) && (date < 31)) document.write("國際勞動(dòng)節(jié)快到了");
if ((month == 4) && (date == 1)) document.write("今天是國際勞動(dòng)節(jié)");
if ((month == 4) && (date > 1) && (date < 4)) document.write("中國青年節(jié)快到了");
if ((month == 4) && (date == 4)) document.write("今天是中國青年節(jié)");
if ((month == 4) && (date > 4) && (date < 8)) document.write("世界紅十字日快到了");
if ((month == 4) && (date == 8)) document.write("今天是世界紅十字日");
if ((month == 4) && (date > 8) && (date < 12)) document.write("國際護(hù)士節(jié)快到了");
if ((month == 4) && (date == 12)) document.write("今天是國際護(hù)士節(jié)");
if ((month == 4) && (date > 12) && (date < 17)) document.write("世界電信日快到了");
if ((month == 4) && (date == 17)) document.write("今天是世界電信日");
if ((month == 4) && (date > 25) && (date < 30)) document.write("國際兒童節(jié)和世界無煙日快到了");
if ((month == 4) && (date == 31)) document.write("今天是世界無煙日");
if ((month == 5) && (date == 1)) document.write("今天是國際兒童節(jié)");
if ((month == 5) && (date > 1) && (date < 5)) document.write("世界環(huán)境日快到了");
if ((month == 5) && (date == 5)) document.write("今天是世界環(huán)境日");
if ((month == 5) && (date > 18) && (date < 23)) document.write("國際奧林匹克日快到了");
if ((month == 5) && (date == 23)) document.write("今天是國際奧林匹克日");
if ((month == 5) && (date > 23) && (date < 26)) document.write("國際禁毒日快到了");
if ((month == 5) && (date == 26)) document.write("今天是國際禁毒日");
if ((month == 5) && (date > 26) && (date < 31)) document.write("中國共產(chǎn)黨誕生紀(jì)念日和世界建筑節(jié)快到了");
if ((month == 6) && (date == 1)) document.write("今天是中國共產(chǎn)黨誕生紀(jì)念日和世界建筑節(jié)");
if ((month == 6) && (date > 25) && (date < 31)) document.write("中國人民解放軍建軍節(jié)快到了");
if ((month == 7) && (date == 1)) document.write("今天是中國人民解放軍建軍節(jié)");
if ((month == 7) && (date > 8) && (date < 13)) document.write("左手節(jié)快到了");
if ((month == 7) && (date == 13)) document.write("今天是左手節(jié)");
if ((month == 8) && (date > 5) && (date < 10)) document.write("教師節(jié)快到了");
if ((month == 8) && (date == 10)) document.write("今天是教師節(jié)");
if ((month == 8) && (date > 13) && (date < 18)) document.write("日本侵華戰(zhàn)爭紀(jì)念日快到了");
if ((month == 8) && (date == 18)) document.write("今天是日本侵華戰(zhàn)爭紀(jì)念日");
if ((month == 8) && (date > 22) && (date < 27)) document.write("世界旅游日快到了");
if ((month == 8) && (date == 27)) document.write("今天是世界旅游日");
if ((month == 8) && (date > 25) && (date < 31)) document.write("中華人民共和國國慶節(jié)快到了");
if ((month == 9) && (date == 1)) document.write("今天是中華人民共和國國慶節(jié)");
if ((month == 9) && (date > 4) && (date < 9)) document.write("世界郵政日快到了");
if ((month == 9) && (date == 9)) document.write("今天是世界郵政日");
if ((month == 9) && (date > 11) && (date < 16)) document.write("世界糧食日快到了");
if ((month == 9) && (date == 16)) document.write("今天是世界糧食日");
if ((month == 10) && (date > 5) && (date < 10)) document.write("世界青年日快到了");
if ((month == 10) && (date == 10)) document.write("今天是世界青年日");
if ((month == 11) && (date > 5) && (date < 10)) document.write("世界人權(quán)日快到了");
if ((month == 11) && (date == 10)) document.write("今天是世界人權(quán)日");
if ((month == 11) && (date > 20) && (date < 25)) document.write("圣誕節(jié)快到了");
if ((month == 11) && (date == 25)) document.write("今天是圣誕節(jié)");
document.write("<br></font>");
//-->
</SCRIPT>