wfcvn 发表于 2007-4-27 11:03:40

***时间日期***语言时钟

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
<html>
<title>time till hour</title>
<head>

<script language="javascript">

<!-- this script and many more are available online from -->
<!-- the javascript source!! http://javascriptsource.com -->

<!-- begin
function number(x) {
if (x==1) return "one"; if (x==2) return "two"; if (x==3) return "three";
if (x==4) return "four"; if (x==5) return "five"; if (x==6) return "six";
if (x==7) return "seven"; if (x==8) return "eight"; if (x==9) return "nine";
if (x==10) return "ten"; if (x==11) return "eleven"; if (x==12) return "twelve";
return x; //default
}
function ishtime(h,m) {
h = number(h)
if (m<=3 || m>57) return h+" o'clock";
if (m<=7)return "five past "+h;
if (m<=12) return "ten past "+h;
if (m<=17) return "quarter past "+h;
if (m<=23) return "twenty past "+h;
if (m<=28) return "twenty-five past "+h;

if (m<=33) return "half past "+h;
if (m<=38) return "twenty-five to "+h;
if (m<=43) return "twenty to "+h;
if (m<=48) return "quarter to "+h;
if (m<=53) return "ten to "+h;
if (m<=58) return "five to "+h;
return "h:m"; // never reached?
}
function daytime(h) {
if (!h || h>21) return " at night"
if (h<12) return " in the morning";
if (h<=17) return " in the afternoon";
return " in the evening"; // default
}
function ish(h,m) {
if (!h && !m) { // if no time supplied, use the system time
time = new date()
h = time.gethours()
m = time.getminutes()
}
z = daytime(h);
h = h % 12 // fix to 12 hour clock
if (m>57 && time.getseconds()>30) m++; // round seconds
if (m>60) m=0 // round up minutes
if (m>33) h++ // round up hours
if (h>12)h = 1 // the clock turns round..
if (h==0) h = 12
return "it's now about "+ishtime(h,m)+z+"."
}
// end -->
</script>

<!-- step two: copy this code into the body of your html document-->

<body>

<center>
<script language="javascript">
<!--hide from old browsers--
document.writeln(ish().fontcolor("black"),"<p>")
<!--done-->
</script>
</center>

      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***时间日期***语言时钟