js時鐘

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT language=javascript>
function showDate()
{
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月" );
var message = "<font>今天是:"+year +"年"+ monthname[month]+ date + "日" + dayname[day]+" "+"</font>";
return message;
}
function showTime()
{
if(!document.layers&&!document.all) return
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
if(hours==0) hours=12
if(minutes<=9) minutes="0"+minutes
if(seconds<=9) seconds="0"+seconds

myclock="<font size='6' face='Arial'>"+hours+":"+minutes+":"+seconds+"</font>"
setTimeout("showTime()",1000)

var message = this.showDate()+"<br/>"+myclock;
var msg = "<font>現在是下午哦!別打瞌睡啊~小心被BOSS扁~<br/>北京  20℃-29℃  多雲轉晴 微風</font>";
document.getElementById("message").innerHTML=message+"<br/>"+msg;
}
//>
</SCRIPT>
</HEAD>

<BODY onload="showTime()">

<p id="message" style="border:1px solid D6D6D6; width=230">
</p>

</BODY>
</HTML>

作者“hellodajun”
 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *