|
|
发表于 2007-8-7 20:31:45
|
显示全部楼层
<html>
( B) }+ L, Z- g$ K" \ A4 E8 `1 m<head>
4 n0 {" D! B! I4 H8 f m% W<title>无标题文档</title>
1 O+ G! Z/ C. C8 N! E) K# }<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
* J5 X" Q: }( z% F/ `; {8 u<style>
! d6 g# ?+ w+ N, a9 `<!--: s! ]1 }2 q" R) E+ i* o- \1 N) s" o
body, p, div,td,input {font:menu;line-height: 150%}
9 I3 o7 o& d0 Q1 O$ R! E: y5 I( a( A.div { font-family: 宋体; font-size: 12px; line-height: 150% }& P9 _* m% T# ?
-->
6 {$ H6 ~: }* c( B</style>9 j' h9 P9 D1 y4 Z/ X
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">3 A8 C; y# [5 ~% G" o" |" [
//创建一个数组,用于存放每个月的天数
+ f+ d; s2 @: w. p0 w/ \3 Z' l) I3 \function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
( i2 c1 L, j8 ~& V3 ?{
- M" s& w% P5 S o. c7 Zthis[0] = m0;
* }: }2 u# j' [- P( E! S1 l4 vthis[1] = m1;5 P4 Q, E( ?8 a6 i( \$ b$ y
this[2] = m2;* c( {. D$ K3 i3 O7 D- ]9 @" ^
this[3] = m3;
/ O$ S! t+ t( e* F9 Z5 X# ]2 Dthis[4] = m4;
% j f8 \6 k" B8 d9 { {this[5] = m5;8 i* F b+ Z! f! U' M5 B
this[6] = m6;9 A, R* F2 O$ F7 M" B5 K
this[7] = m7;
, C8 C9 ~0 X# F$ e- Y1 kthis[8] = m8;; z2 i4 b1 F7 C; X7 u" n( p& [ G4 V
this[9] = m9;
7 P V5 g, ?1 b' T) {5 Y1 `+ z& xthis[10] = m10;+ v8 I3 P6 ^" d2 M
this[11] = m11;: h. \ e) ]0 ?8 ]% [# U
}' h4 l$ ~* S; j6 X! m
//实现月历 b6 K) f- v1 G& \- l) S& B
function calendar() {8 v. d0 A/ G; p9 K/ \# W
var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";4 r2 Y4 ?) M" `* j' B: n
var today = new Date();( e' l5 Y/ X& ?3 f3 `4 B1 Q
var thisDay;4 E2 k) Y- h! i( s
var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
6 {- L$ _: r- T) Byear = today.getYear() +1900;
+ a" E$ N# V, \# U/ f9 g) p: AthisDay = today.getDate();7 Z9 `. M; E; M
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;. }+ x& C, x0 g/ {; ~; g
nDays = monthDays[today.getMonth()];
' H" r/ p1 i/ U4 k( q* M9 P4 @firstDay = today;: ?+ v9 O5 U! v+ ^
firstDay.setDate(1);$ q5 b" ?4 @5 `
testMe = firstDay.getDate();; v% w9 \8 J9 W
if (testMe == 2) firstDay.setDate(0);; h. w3 V# ]! @* \ q
startDay = firstDay.getDay();: @- M# A! Z. F( G0 V6 a* e
document.write("<div id='rili' style='position:absolute;width:140px;left:300px;top:100px;'>")
0 v% J, }5 W7 \1 ]& Z0 S$ `# |document.write("<TABLE width='217' BORDER='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#0080FF'>"); S5 S* y1 t; R* P
document.write("<TR><TD><table border='0' cellspacing='1' cellpadding='2' bgcolor='Silver'>"); b$ q( T% H- M5 S& N' }5 r$ c
document.write("<TR><th colspan='7' bgcolor='#C8E3FF'>");. f# r& S b7 c( G5 ?0 U0 ~; n
var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
; ?) y4 r* W' i8 C/ ~- m* kvar monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");3 a7 e3 I E; Z5 j8 q, U |
var now = new Date();
8 S& M! X$ b4 o S" R d+ idocument.writeln("<FONT STYLE='font-size:9pt;Color:#330099'>" + "公元 " + now.getYear() + "年" + monthNames[now.getMonth()] + " " + now.getDate() + "日 " + dayNames[now.getDay()] + "</FONT>");
, F/ \6 H+ w; R2 ]2 e1 |document.writeln("</TH></TR><TR><TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>日</FONT></TH>");& U7 W4 T3 e' F( s# l
document.writeln("<th bgcolor='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>一</FONT></TH>");
5 ^ y0 v5 W6 V& ldocument.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>二</FONT></TH>"); P1 j6 S/ ]7 f
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>三</FONT></TH>");3 O) o5 k% J- |8 S% v
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>四</FONT></TH>");. B+ _2 Z0 s- n% ~
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>五</FONT></TH>");5 G* v8 \) J9 f; ^& g4 `+ ]# F
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>六</FONT></TH>");8 e2 ^ q1 E8 L+ q* O; ?
document.writeln("</TR><TR>");8 a. M% N6 \. H) S$ @2 X
column = 0;
/ D: g/ u6 V! D3 r" [4 Efor (i=0; i<startDay; i++) {; f9 C @% U% B4 x: K( ^
document.writeln("\n<TD><FONT STYLE='font-size:9pt'> </FONT></TD>");- ?9 T3 \7 }. w- v5 I2 U+ b
column++;. R7 |. P3 A) y0 s: t: [
}
1 U [; B3 |2 x
) }# L. p2 |; h ~$ g8 sfor (i=1; i<=nDays; i++) {
( z' S2 P: k+ Q8 b+ f7 mif (i == thisDay) {
2 K) w3 q" G' i; H5 J& Fdocument.writeln("</TD><TD ALIGN='CENTER' BGCOLOR='#FF8040'><FONT STYLE='font-size:9pt;Color:#ffffff'><B>")% l9 Y" V& u2 }% r) A9 [( m
}/ A& l; p% O5 ~1 l
else {4 i7 b' k) a7 K6 B* q
document.writeln("</TD><TD BGCOLOR='#FFFFFF' ALIGN='CENTER'><FONT STYLE='font-size:9pt;font-family:Arial;font-weight:bold;Color:#330066'>");" L7 r; m) ^7 }4 v) z! {# |+ ^
}
N6 C" I8 Q4 odocument.writeln(i);
3 J3 N# G, v: ~" E3 }* Uif (i == thisDay) document.writeln("</FONT></TD>")' h( @* }6 B' x- M- y- z
column++;) ]; U+ x1 k2 v9 P& X4 h( ~% P# n$ X
if (column == 7) {
8 @$ J8 T+ _0 {) x% N* V7 U5 Sdocument.writeln("<TR>"); . z" v; }; B" M7 i
column = 0;% O, g# d/ D3 k& M; j
}# Z* m" k0 `: Z k: J) E
}
1 m) V) H2 n1 y9 m. E, ^: ldocument.writeln("<TR><TD COLSPAN='7' ALIGN='CENTER' VALIGN='TOP' BGCOLOR='#0080FF'>")
3 c0 |- L: I# ?document.writeln("<FORM NAME='clock' onSubmit='0'><FONT STYLE='font-size:9pt;Color:#ffffff'>")
+ k% f& l' _& Ndocument.writeln("现在时间:<INPUT TYPE='Text' NAME='face' ALIGN='TOP'></FONT></FORM></TD></TR></TABLE>")
p7 ~+ L2 V8 }7 P) a3 B( ~document.writeln("</TD></TR></TABLE></div>");
1 x5 c# y- V Z, s' s! t3 M! J/ m; ]}
5 n' r, b( W$ Y$ n</SCRIPT>
* x& y5 ~, s) \% C) ~2 h! E" s<SCRIPT LANGUAGE="JavaScript">- C/ [' {; y6 o* h: h* |) A
var timerID = null;/ O1 J. A' J6 ?# y) h! c% I
var timerRunning = false;
' H7 D0 \7 p6 q8 a" b4 \
/ H) Q& x. R7 m2 @function stopclock (){
! M0 P1 e8 Z! z3 Vif(timerRunning)
0 f& l6 ?; {1 q. AclearTimeout(timerID);" [: I E B2 V& V' l* X& s7 R
timerRunning = false;}* d* H$ d; K# f# c
/ m1 ?: H! y# d D: l* U
//显示当前时间7 c: A/ U+ ]3 G9 K% {- e
function showtime () {
4 C: F. L4 S1 H% ?( Tvar now = new Date();
0 r; T- d+ h* V. Yvar hours = now.getHours();8 Q. ~3 v# B/ a `0 v: F
var minutes = now.getMinutes();
4 X+ n. U: ~) A$ S6 ~! D1 V* l# Z( w) svar seconds = now.getSeconds()' o$ c" x2 c% |' L8 Y
var timeValue = " " + ((hours >12) ? hours -12 :hours), o$ W% s4 h. O; t
timeValue += ((minutes < 10) ? ":0" : ":") + minutes9 z# ^' h% E& [! U& E& f5 E8 H& }
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
8 N4 P9 H) `9 c. r% a/ EtimeValue += (hours >= 12) ? " 下午 " : " 上午 "
2 k1 u' Z4 h0 f+ hdocument.clock.face.value = timeValue;
/ m7 l* h8 O( m5 I0 ltimerID = setTimeout("showtime()",1000);//设置超时,使时间动态显示! l5 Q' q- a5 @
timerRunning = true;}8 d) H# h5 e1 D2 U! e; C
* x$ ^' y0 U9 J& v$ W
function startclock () {# S7 t# I1 I6 a) I m. t
stopclock();9 R. o- w- Y( @" z! y) k& o; M3 ~1 _
showtime();}
4 Y! M% A" D3 F8 V1 t7 Q' l</SCRIPT>
# C! F' Q5 N7 \# s
( o' o1 t: S# G0 Z; B3 o- b2 ]</head>
% i- N% P+ L* T" `/ P
9 q. N, P; D- ]<body bgcolor="#FFFFFF" onLoad="startclock(); timerONE=window.setTimeout"text="#000000">
, t5 I3 c/ N" h( T+ A% }" u- u<script language="JavaScript" type="text/javascript">, ]7 ?4 M1 [( @* o0 r
<!--/ ~ Y9 ]! ]5 ^ Y. B+ A
calendar();) R; ]' B. p- c6 v) ]
//-->
/ j! o$ q3 `/ B, r: H+ @% L1 i* s R2 q, a8 C7 k" t
</script>
5 K! g4 o6 m- C: n# S" c! l; j: p9 h% ~) V' u5 V$ B. u
</body>
3 k# v% B; {3 e</html> |
|