» 网友学堂 » Javascript教程 » 2000年日历
2000年日历
作者:ljjk5 发表时间:2007-4-8 09:06 阅读:1861次 在百度搜索相关内容

2000年日历



下面为效果显示区!
January 2000
Mon Tue Wed Thu Fri Sat Sun
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31


February 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28


March 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31


April 2000
Mon Tue Wed Thu Fri Sat Sun
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30


May 2000
Mon Tue Wed Thu Fri Sat Sun

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31


June 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30


July 2000
Mon Tue Wed Thu Fri Sat Sun
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31


August 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31


September 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30


October 2000
Mon Tue Wed Thu Fri Sat Sun
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31


November 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30


December 2000
Mon Tue Wed Thu Fri Sat Sun
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31







脚本说明:
第一步:把如下代码加入<body>区域中
<script language="javascript">
<!--
// fill the month table with column headings
function day_title(day_name){
document.write("<TD ALIGN=center WIDTH=35>"+day_name+"</TD>")
}

// fills the month table with numbers

function fill_table(month,month_length)

{

day=1

// begin the new month table

document.write("<TABLE BORDER=3 CELLSPACING=3 CELLPADDING=%3><TR>")

document.write("<TD COLSPAN=7 ALIGN=center><B>"+month+" "+year+"</B><TR>")

// column headings


day_title("Mon")

day_title("Tue")

day_title("Wed")

day_title("Thu")

day_title("Fri")

day_title("Sat")

day_title("Sun")

// pad cells before first day of month

document.write("</TR><TR>")

for (var i=1;i<start_day;i++){

document.write("<TD>")

}

// fill the first week of days

for (var i=start_day;i<8;i++){

document.write("<TD ALIGN=center>"+day+"</TD>")

day++

}

document.write("<TR>")



// fill the remaining weeks

while (day <= month_length) {

for (var i=1;i<=7 && day<=month_length;i++){

document.write("<TD ALIGN=center>"+day+"</TD>")

day++

}

document.write("</TR><TR>")

// the first day of the next month

start_day=i

}

document.write("</TR></TABLE><BR>")

}

// end hiding -->

</script>


第二步:把如下代码加入<body>区域中
<script language="javascript">

// year

year=2000

// first day of the week of the new year

today= new Date("January 1, "+year)

start_day = today.getDay() + 1 // starts with 0

fill_table("January",31)

fill_table("February",28)

fill_table("March",31)

fill_table("April",30)

fill_table("May",31)

fill_table("June",30)

fill_table("July",31)

fill_table("August",31)

fill_table("September",30)

fill_table("October",31)

fill_table("November",30)

fill_table("December",31)

</script>

#Advertisement