当前位置:首页 > 代码 > 正文

网站日历代码(中国日历网址)

admin 发布:2022-12-19 03:17 126


本篇文章给大家谈谈网站日历代码,以及中国日历网址对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

javascript html实现网页版日历代码

本文实例为大家分享了网页版日历代码,供大家参考,具体内容如下

效果图:

实现代码:

html

head

link

rel="stylesheet"

type="text/css"

href="Skin.css"

style

!--

table{

text-align:

center

}

--

/style

/head

body

div

align="center"

script

language="javascript"

var

my

=

new

Date();

function

showc()

{

var

k=1;

var

j=1;

var

today;

var

tomonth;

var

theday=1;//日期

var

max;

var

temp;

var

tempday;//这个月第一天的星期

document.write

("b"

+

my.getFullYear()

+

"-"

+

(my.getMonth()+1)

+

"/b");

document.write

("table

border='1'

width='273'

height='158'");

document.write

("tr");

document.write

("td

height='23'

width='39'font

color='red'Sun/font/td");

document.write

("td

height='23'

width='39'Mon/td");

document.write

("td

height='23'

width='39'Tue/td");

document.write

("td

height='23'

width='39'Wed/td");

document.write

("td

height='23'

width='39'Thu/td");

document.write

("td

height='23'

width='39'Fri/td");

document.write

("td

height='23'

width='39'Sat/td");

document.write

("/tr");

temp=my.getDate();

my.setDate(1);

//document.write

(my.getDate());

tempday=my.getDay();//返回第一天是星期几

my.setDate(temp);

today=my.getDay();//返回现在星期几

switch

((my.getMonth()+1))

{

case

1:

case

3:

case

5:

case

7:

case

8:

case

10:

case

12:

max=31;

break;

case

4:

case

6:

case

9:

case

11:

max=30;

break;

default:

max=29;//这里没有考虑闰月!!

//document.write

(max);

}

for(k=0;k6;k++)

{

document.write

("tr");

for(j=0;j=6;j++)

{

document.write

("td

height='23'

width='39'");

if(j=(tempday))

{

tempday=0;//设置为最小,相当于取消判断条件

if(theday=max)

{

document.write

("a

title="

+

my.getFullYear()

+

"-"

+

(my.getMonth()+1)

+

"-"

+theday

+

"

target='_blank'

href=detail.asp?date="

+

theday

+

"");

if(theday==my.getDate())

document.write

("font

color='green'["

+

theday

+

"]/font/a");

else

if(j==0)

document.write

("font

color='red'"

+

theday

+

"/font/a");

else

document.write

(theday

+

"/a");

theday++;

}

}

document.write

("/td");

}

document.write

("/tr");

}

document.write

("/table");

}

showc();

/script

/div

body

/html

以上就是本文的全部内容,希望大家可以轻松实现网页版日历。

关于网站日历代码的问题

以下是我修改过的可以在2008年使用的代码,如果明年还要用,你可参照万年历修改一下即可.

script!--

var bsYear;

var bsDate;

var bsWeek;

var arrLen=10; //数组长度

var sValue=0; //当年的秒数

var dayiy=0; //当年第几天

var miy=0; //月份的下标

var iyear=0; //年份标记

var dayim=0; //当月第几天

var spd=86400; //每天的秒数

var year1999="30;29;29;30;29;29;30;29;30;30;30;29"; //354

var year2000="30;30;29;29;30;29;29;30;29;30;30;29"; //354

var year2001="30;30;29;30;29;30;29;29;30;29;30;29;30"; //384

var year2002="30;30;29;30;29;30;29;29;30;29;30;29"; //354

var year2003="30;30;29;30;30;29;30;29;29;30;29;30"; //355

var year2004="29;30;29;30;30;29;30;29;30;29;30;29;30"; //384

var year2005="29;30;29;30;29;30;30;29;30;29;30;29"; //354

var year2006="30;29;30;29;30;29;30;29;30;30;29;30;30";

var year2007="29;29;30;29;29;30;29;30;30;30;29;30";

var year2008="30;29;29;30;29;29;30;29;30;30;29;30";

var month1999="正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"

var month2001="正月;二月;三月;四月;闰四月;五月;六月;七月;八月;九月;十月;十一月;十二月"

var month2004="正月;二月;闰二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"

var month2006="正月;二月;三月;四月;五月;六月;七月;闰七月;八月;九月;十月;十一月;十二月"

var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿

四;廿五;廿六;廿七;廿八;廿九;三十";

var Ys=new Array(arrLen);

Ys[0]=919094400;Ys[1]=949680000;Ys[2]=980265600;

Ys[3]=1013443200;Ys[4]=1044028800;Ys[5]=1074700800;

Ys[6]=1107878400;Ys[7]=1138464000; Ys[8]=1171728000;

Ys[9]=1202313600;

var Yn=new Array(arrLen); //农历年的名称

Yn[0]="己卯年";Yn[1]="庚辰年";Yn[2]="辛巳年";

Yn[3]="壬午年";Yn[4]="癸未年";Yn[5]="甲申年";

Yn[6]="乙酉年";Yn[7]="丙戌年";Yn[8]="丁亥年";

Yn[9]="戊子年";

var D=new Date();

var yy=D.getYear();

var mm=D.getMonth()+1;

var dd=D.getDate();

var ww=D.getDay();

if (ww==0) ww="font color=RED 星期日 ";

if (ww==1) ww=" 星期一 ";

if (ww==2) ww=" 星期二 ";

if (ww==3) ww=" 星期三 ";

if (ww==4) ww=" 星期四 ";

if (ww==5) ww=" 星期五 ";

if (ww==6) ww="font color=RED 星期六 ";

ww=ww;

var ss=parseInt(D.getTime() / 1000);

if (yy100) yy="19"+yy;

for (i=0;iarrLen;i++)

if (ss=Ys[i]){

iyear=i;

sValue=ss-Ys[i]; //当年的秒数

}

dayiy=parseInt(sValue/spd)+1; //当年的天数

var dpm=year1999;

if (iyear==1) dpm=year2000;

if (iyear==2) dpm=year2001;

if (iyear==3) dpm=year2002;

if (iyear==4) dpm=year2003;

if (iyear==5) dpm=year2004;

if (iyear==6) dpm=year2005;

if (iyear==7) dpm=year2006;

if (iyear==8) dpm=year2007;

if (iyear==9) dpm=year2008;

dpm=dpm.split(";");

var Mn=month1999;

if (iyear==2) Mn=month2001;

if (iyear==5) Mn=month2004;

if (iyear==7) Mn=month2006;

Mn=Mn.split(";");

var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿

四;廿五;廿六;廿七;廿八;廿九;三十";

Dn=Dn.split(";");

dayim=dayiy;

var total=new Array(12);

total[0]=parseInt(dpm[0]);

for (i=1;idpm.length-1;i++) total[i]=parseInt(dpm[i])+total[i-1];

for (i=dpm.length-1;i0;i--)

if (dayimtotal[i-1]){

dayim=dayim-total[i-1];

miy=i;

}

bsWeek=ww;

bsDate=yy+"年"+mm+"月";

bsDate2=dd+"日";

bsYear="农历"+Yn[iyear];

bsYear2=Mn[miy]+Dn[dayim-1];

if (ss=Ys[9]||ssYs[0]) bsYear=Yn[9];

function CAL(){

document.write("font color=red"+bsDate+"/fontfont color=red"+bsDate2+"/fontfont color=red");

document.write(bsWeek+"font color=red");

document.write(bsYear+bsYear2);

}

//--

/script

请问网页中的日历怎么做

1

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title一个很漂亮实用的日历/title

SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"

//创建一个数组,用于存放每个月的天数

function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)

{

this[0] = m0;

this[1] = m1;

this[2] = m2;

this[3] = m3;

this[4] = m4;

this[5] = m5;

this[6] = m6;

this[7] = m7;

this[8] = m8;

this[9] = m9;

this[10] = m10;

this[11] = m11;

}

//实现月历

function calendar() {

var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";

var today = new Date();

var thisDay;

var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

year = today.getYear() +1900;

thisDay = today.getDate();

if (((year % 4 == 0) (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;

nDays = monthDays[today.getMonth()];

firstDay = today;

firstDay.setDate(1);

testMe = firstDay.getDate();

if (testMe == 2) firstDay.setDate(0);

startDay = firstDay.getDay();

document.write("div id='rili' style='position:absolute;width:140px;left:300px;top:100px;'")

document.write("TABLE width='217' BORDER='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#0080FF'")

document.write("TRTDtable border='0' cellspacing='1' cellpadding='2' bgcolor='Silver'");

document.write("TRth colspan='7' bgcolor='#C8E3FF'");

var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");

var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");

var now = new Date();

document.writeln("FONT STYLE='font-size:9pt;Color:#330099'" + "公元 " + now.getYear() + "年" + monthNames[now.getMonth()] + " " + now.getDate() + "日 " + dayNames[now.getDay()] + "/FONT");

document.writeln("/TH/TRTRTH BGCOLOR='#0080FF'FONT STYLE='font-size:9pt;Color:White'日/FONT/TH");

document.writeln("th bgcolor='#0080FF'FONT STYLE='font-size:9pt;Color:White'一/FONT/TH");

document.writeln("TH BGCOLOR='#0080FF'FONT STYLE='font-size:9pt;Color:White'二/FONT/TH");

document.writeln("TH BGCOLOR='#0080FF'FONT STYLE='font-size:9pt;Color:White'三/FONT/TH");

document.writeln("TH BGCOLOR='#0080FF'FONT STYLE='font-size:9pt;Color:White'四/FONT/TH");

document.writeln("TH BGCOLOR='#0080FF'FONT STYLE='font-size:9pt;Color:White'五/FONT/TH");

document.writeln("TH BGCOLOR='#0080FF'FONT STYLE='font-size:9pt;Color:White'六/FONT/TH");

document.writeln("/TRTR");

column = 0;

for (i=0; istartDay; i++) {

document.writeln("\nTDFONT STYLE='font-size:9pt' /FONT/TD");

column++;

}

for (i=1; i=nDays; i++) {

if (i == thisDay) {

document.writeln("/TDTD ALIGN='CENTER' BGCOLOR='#FF8040'FONT STYLE='font-size:9pt;Color:#ffffff'B")

}

else {

document.writeln("/TDTD BGCOLOR='#FFFFFF' ALIGN='CENTER'FONT STYLE='font-size:9pt;font-family:Arial;font-weight:bold;Color:#330066'");

}

document.writeln(i);

if (i == thisDay) document.writeln("/FONT/TD")

column++;

if (column == 7) {

document.writeln("TR");

column = 0;

}

}

document.writeln("TRTD COLSPAN='7' ALIGN='CENTER' VALIGN='TOP' BGCOLOR='#0080FF'")

document.writeln("FORM NAME='clock' onSubmit='0'FONT STYLE='font-size:9pt;Color:#ffffff'")

document.writeln("现在时间:INPUT TYPE='Text' NAME='face' ALIGN='TOP'/FONT/FORM/TD/TR/TABLE")

document.writeln("/TD/TR/TABLE/div");

}

/SCRIPT

SCRIPT LANGUAGE="JavaScript"

var timerID = null;

var timerRunning = false;

function stopclock (){

if(timerRunning)

clearTimeout(timerID);

timerRunning = false;}

//显示当前时间

function showtime () {

var now = new Date();

var hours = now.getHours();

var minutes = now.getMinutes();

var seconds = now.getSeconds()

var timeValue = " " + ((hours 12) ? hours -12 :hours)

timeValue += ((minutes 10) ? ":0" : ":") + minutes

timeValue += ((seconds 10) ? ":0" : ":") + seconds

timeValue += (hours = 12) ? " 下午 " : " 上午 "

document.clock.face.value = timeValue;

timerID = setTimeout("showtime()",1000);//设置超时,使时间动态显示

timerRunning = true;}

function startclock () {

stopclock();

showtime();}

/SCRIPT

/head

body onLoad="startclock(); timerONE=window.setTimeout"

script language="JavaScript" type="text/javascript"

!--

calendar();

//--

/script

/body

/html

2

html

head

titleCool日历/title

/headBODY background="../images/bg.gif"

!--将以下代码加入HTML的Body/Body之间--

script language="JavaScript"

!-- Hide this script from old browsers --

function greeting()

{

var today = new Date();

var hrs = today.getHours();

document.writeln("CENTER");

document.write("Good ");

if (hrs 6)

document.write("(Early) Morning");

else if (hrs 12)

document.write("Morning");

else if (hrs = 18)

document.write("Afternoon");

else

document.write("Evening");

document.write("!");

document.write("当前时间是:");

dayStr = today.toLocaleString();

document.write(dayStr);

document.writeln("/CENTER");

}

function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)

{

this[0] = m0;

this[1] = m1;

this[2] = m2;

this[3] = m3;

this[4] = m4;

this[5] = m5;

this[6] = m6;

this[7] = m7;

this[8] = m8;

this[9] = m9;

this[10] = m10;

this[11] = m11;

}

function calendar()

{

var today = new Date();

var thisDay;

var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30,

31, 30, 31);

year = today.getYear();

if (year2000)

year=year+1900;

thisDay = today.getDate();

if (((year % 4 == 0) (year % 100 != 0)) || (year % 400 == 0))

monthDays[1] = 29;

nDays = monthDays[today.getMonth()];

firstDay = today;

firstDay.setDate(1); // works fine for most systems

testMe = firstDay.getDate();

if (testMe == 2)

firstDay.setDate(0);

startDay = firstDay.getDay();

document.writeln("CENTER");

document.write("TABLE BORDER bgcolor=moccasin");

document.write("TRTH COLSPAN=7");

document.write(year+'年');

document.write(today.getMonth()+1+'月');

document.write("TRTH日TH一TH二TH三TH四TH五TH六");

document.write("TR");

column = 0;

for (i=0; istartDay; i++)

{

document.write("TD");

column++;

}

for (i=1; i=nDays; i++)

{

document.write("TD");

if (i == thisDay)

document.write("FONT COLOR=\"red\"")

document.write(i);

if (i == thisDay)

document.write("/FONT")

column++;

if (column == 7)

{

document.write("TR");

column = 0;

}

}

document.write("/TABLE");

document.writeln("/CENTER");

}

greeting();

document.write("br");

calendar();

document.write("");

// -- End Hiding Here --

/script

/body/html

3

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title在线记事的日历/title

/head

body

script LANGUAGE="JavaScript"

!-- hk--!-- khjk--

!-- ghjk--!-- hjk--as is.

var caution = false

function setCookie(name, value, expires, path, domain, secure) {

var curCookie = name + "=" + escape(value) +

((expires) ? "; expires=" + expires.toGMTString() : "") +

((path) ? "; path=" + path : "") +

((domain) ? "; domain=" + domain : "") +

((secure) ? "; secure" : "")

if (!caution || (name + "=" + escape(value)).length = 4000)

document.cookie = curCookie

else

if (confirm("Cookie exceeds 4KB and will be cut!"))

document.cookie = curCookie

}

function getCookie(name) {

var prefix = name + "="

var cookieStartIndex = document.cookie.indexOf(prefix)

if (cookieStartIndex == -1)

return null

var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)

if (cookieEndIndex == -1)

cookieEndIndex = document.cookie.length

return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))

}

function deleteCookie(name, path, domain) {

if (getCookie(name)) {

document.cookie = name + "=" +

((path) ? "; path=" + path : "") +

((domain) ? "; domain=" + domain : "") +

"; expires=Thu, 01-Jan-70 00:00:01 GMT"

}

}

function fixDate(date) {

var base = new Date(0)

var skew = base.getTime()

if (skew 0)

date.setTime(date.getTime() - skew)

}

function initCookie(monthName) {

var text = ""

for (var i = 1; i = 31; ++i) {

text += "^" + i + "^"

}

var now = new Date()

fixDate(now)

now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31)

setCookie(monthName + "Calendar", text, now)

}

function getSpecificReminder(num, monthName) {

var prefix = "^" + num + "^"

var totalCookie = getCookie(monthName + "Calendar")

var startIndex = totalCookie.indexOf(prefix, 0)

var startData = totalCookie.indexOf("^", startIndex + 1) + 1

if (num == 31)

var endData = totalCookie.length

else

var endData = totalCookie.indexOf("^", startData)

return totalCookie.substring(startData, endData)

}

function setSpecificReminder(num, monthName, newValue) {

var prefix = "^" + num + "^"

var totalCookie = getCookie(monthName + "Calendar")

var startIndex = totalCookie.indexOf(prefix, 0)

var startData = totalCookie.indexOf("^", startIndex + 1) + 1

if (num == 31)

var endData = totalCookie.length

else

var endData = totalCookie.indexOf("^", startData)

var now = new Date()

fixDate(now)

now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31)

setCookie(monthName + "Calendar", totalCookie.substring(0, startData) + newValue + totalCookie.substring(endData, totalCookie.length), now)

}

function getInput(num, monthName) {

if (!getCookie(monthName + "Calendar"))

initCookie(monthName)

var newValue = prompt("Enter reminder for current date:", getSpecificReminder(num, monthName))

if (newValue)

setSpecificReminder(num, monthName, newValue)

}

function getTime() {

var now = new Date()

var hour = now.getHours()

var minute = now.getMinutes()

now = null

var ampm = ""

if (hour = 12) {

hour -= 12

ampm = "PM"

} else

ampm = "AM"

hour = (hour == 0) ? 12 : hour

if (minute 10)

minute = "0" + minute

return hour + ":" + minute + " " + ampm

}

function leapYear(year) {

if (year % 4 == 0)

return true

return false

}

function getDays(month, year) {

var ar = new Array(12)

ar[0] = 31

ar[1] = (leapYear(year)) ? 29 : 28 // February

ar[2] = 31

ar[3] = 30

ar[4] = 31

ar[5] = 30

ar[6] = 31

ar[7] = 31

ar[8] = 30

ar[9] = 31

ar[10] = 30

ar[11] = 31

return ar[month]

}

function getMonthName(month) {

var ar = new Array(12)

ar[0] = "一月"

ar[1] = "二月"

ar[2] = "三月"

ar[3] = "四月"

ar[4] = "五月"

ar[5] = "六月"

ar[6] = "七月"

ar[7] = "八月"

ar[8] = "九月"

ar[9] = "十月"

ar[10] = "十一月"

ar[11] = "十二月"

return ar[month]

}

function setCal() {

var now = new Date()

var year = now.getYear()

var month = now.getMonth()

var monthName = getMonthName(month)

var date = now.getDate()

now = null

var firstDayInstance = new Date(year, month, 1)

var firstDay = firstDayInstance.getDay()

firstDayInstance = null

var days = getDays(month, year)

drawCal(firstDay + 1, days, date, monthName, year)

}

function drawCal(firstDay, lastDate, date, monthName, year) {

var headerHeight = 50

var border = 2

var cellspacing = 4

var headerColor = "midnightblue"

var headerSize = "+3"

var colWidth = 60

var dayCellHeight = 25

var dayColor = "darkblue"

var cellHeight = 40

var todayColor = "red"

var timeColor = "purple"

var text = ""

text += 'CENTER'

text += 'TABLE BORDER=' + border + ' CELLSPACING=' + cellspacing + ''

text += 'TH COLSPAN=7 HEIGHT=' + headerHeight + ''

text += 'FONT COLOR="' + headerColor + '" SIZE=' + headerSize + ''

text += monthName + ' ' + year

text += '/FONT'

text += '/TH'

var openCol = 'TD WIDTH=' + colWidth + ' HEIGHT=' + dayCellHeight + ''

openCol += 'FONT COLOR="' + dayColor + '"'

var closeCol = '/FONT/TD'

var weekDay = new Array(7)

weekDay[0] = "Sun"

weekDay[1] = "Mon"

weekDay[2] = "Tues"

weekDay[3] = "Wed"

weekDay[4] = "Thu"

weekDay[5] = "Fri"

weekDay[6] = "Sat"

text += 'TR ALIGN="center" VALIGN="center"'

for (var dayNum = 0; dayNum 7; ++dayNum) {

text += openCol + weekDay[dayNum] + closeCol

}

text += '/TR'

var digit = 1

var curCell = 1

for (var row = 1; row = Math.ceil((lastDate + firstDay - 1) / 7); ++row) {

text += 'TR ALIGN="right" VALIGN="top"'

for (var col = 1; col = 7; ++col) {

if (digit lastDate)

break

if (curCell firstDay) {

text += 'TD/TD';

curCell++

} else {

if (digit == date) {

text += 'TD HEIGHT=' + cellHeight + ''

text += 'FONT COLOR="' + todayColor + '"'

text += 'A HREF="javascript:getInput(' + digit + ', \'' + monthName + '\')" onMouseOver="window.status = \'Store or retrieve data for ' + monthName + ' ' + digit + '\'; return true"FONT COLOR="' + todayColor + '"' + digit + '/FONT/A'

text += 'BR'

text += 'FONT COLOR="' + timeColor + '" SIZE=2'

text += 'CENTER' + getTime() + '/CENTER'

text += '/FONT'

text += '/TD'

} else

text += 'TD HEIGHT=' + cellHeight + 'A HREF="javascript:getInput(' + digit + ', \'' + monthName + '\')" onMouseOver="window.status = \'Store or retrieve data for ' + monthName + ' ' + digit + '\'; return true"' + digit + '/A/TD'

digit++

}

}

text += '/TR'

}

text += '/TABLE'

text += '/CENTER'

document.write(text)

}

setCal()

/script

/body

/html

求日历的HTML代码...

网页台历代码如下:html

head

title网页上的日期台历/title

STYLE

A.menuitem {

COLOR: menutext; TEXT-DECORATION: none

}

A.menuitem:hover {

COLOR: highlighttext; BACKGROUND-COLOR: highlight

}

DIV.contextmenu {

BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; Z-INDEX: 999; VISIBILITY: hidden; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; POSITION: absolute; BACKGROUND-COLOR: buttonface

}

/STYLE

/head

body

SCRIPT language=JavaScript

function Year_Month(){

var now = new Date();

var yy = now.getYear();

var mm = now.getMonth()+1;

var cl = 'font color="#0000df"';

if (now.getDay() == 0) cl = 'font color="#c00000"';

if (now.getDay() == 6) cl = 'font color="#00c000"';

return(cl + yy + '年' + mm + '月/font'); }

function Date_of_Today(){

var now = new Date();

var cl = 'font color="#ff0000"';

if (now.getDay() == 0) cl = 'font color="#c00000"';

if (now.getDay() == 6) cl = 'font color="#00c000"';

return(cl + now.getDate() + '/font'); }

function Day_of_Today(){

var day = new Array();

day[0] = "星期日";

day[1] = "星期一";

day[2] = "星期二";

day[3] = "星期三";

day[4] = "星期四";

day[5] = "星期五";

day[6] = "星期六";

var now = new Date();

///

var cl = 'font color="#0000df"';

if (now.getDay() == 0) cl = 'font color="#c00000"';

if (now.getDay() == 6) cl = 'font color="#00c000"';

return(cl + day[now.getDay()] + '/font'); }

function CurentTime(){

var now = new Date();

var hh = now.getHours();

var mm = now.getMinutes();

var ss = now.getTime() % 60000;

ss = (ss - (ss % 1000)) / 1000;

var clock = hh+':';

if (mm 10) clock += '0';

clock += mm+':';

if (ss 10) clock += '0';

clock += ss;

return(clock); }

function refreshCalendarClock(){

document.all.calendarClock1.innerHTML = Year_Month();

document.all.calendarClock2.innerHTML = Date_of_Today();

document.all.calendarClock3.innerHTML = Day_of_Today();

document.all.calendarClock4.innerHTML = CurentTime(); }

var webUrl = webUrl;

document.write('table border="0" cellpadding="0" cellspacing="0"trtd');

document.write('table id="CalendarClockFreeCode" border="0" cellpadding="0" cellspacing="0" width="60" height="70" ');

document.write('style="position:absolute;visibility:hidden" bgcolor="#eeeeee"');

document.write('trtd align="center"font ');

document.write('style="cursor:hand;color:#ff0000;font-size:14pt;line-height:120%" ');

if (webUrl != 'netflower'){

document.write('/td/trtrtd align="center"font ');

document.write('style="cursor:hand;color:#2000ff;font-size:9pt;line-height:110%" ');

}

document.write('/td/tr/table');

document.write('table border="0" cellpadding="0" cellspacing="0" width="61" bgcolor="#C0C0C0" height="70"');

document.write('trtd valign="top" width="100%" height="100%"');

document.write('table border="1" cellpadding="0" cellspacing="0" width="58" bgcolor="#FEFEEF" height="67"');

document.write('trtd align="center" width="100%" height="100%" ');

document.write('font id="calendarClock1" style="font-size:7pt;line-height:120%"/fontbr');

document.write('font id="calendarClock2" style="color:#ff0000;font-family:Arial;font-size:14pt;line-height:120%"/fontbr');

document.write('font id="calendarClock3" style="font-size:9pt;line-height:120%"/fontbr');

document.write('font id="calendarClock4" style="color:#100080;font-size:8pt;line-height:120%"b/b/font');

document.write('/td/tr/table');

document.write('/td/tr/table');

document.write('/td/tr/table');

setInterval('refreshCalendarClock()',1000);

/SCRIPT

/body

/html

求 网页日历代码

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title日历代码/title

/head

body

SCRIPT language=JavaScript

!--

var lunarInfo=new Array(

0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,

0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,

0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,

0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,

0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,

0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,

0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,

0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,

0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,

0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,

0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,

0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,

0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,

0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,

0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)

var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");

var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");

var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");

var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至")

var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758)

var nStr1 = new Array('日','一','二','三','四','五','六','七','八','九','十')

var nStr2 = new Array('初','十','廿','卅',' ')

var monthName = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");

//国历节日 *表示放假日

var sFtv = new Array(

"0101*元旦",

"0214 情人节",

"0303 我生日",

"0308 妇女节",

"0312 植树节",

"0315 消费者权益日",

"0317 St. Patrick's",

"0401 愚人节",

"0501 劳动节",

"0504 青年节",

"0512 护士节",

"0512 茵生日",

"0601 儿童节",

"0614 Flag Day",

"0701 建党节 香港回归纪念",

"0703 炎黄在线诞辰",

"0718 托普诞辰",

"0801 建军节",

"0808 父亲节",

"0909 毛泽东逝世纪念",

"0910 教师节",

"0928 孔子诞辰",

"1001*国庆节",

"1006 老人节",

"1024 联合国日",

"1111 Veteran's / Remembrance Day",

"1112 孙中山诞辰纪念",

"1220 澳门回归纪念",

"1225 Christmas Day",

"1226 毛泽东诞辰纪念")

//农历节日 *表示放假日

var lFtv = new Array(

"0101*春节",

"0115 元宵节",

"0505 端午节",

"0707 七夕情人节",

"0715 中元节",

"0815 中秋节",

"0909 重阳节",

"1208 腊八节",

"1224 小年",

"0100*除夕")

//某月的第几个星期几

var wFtv = new Array(

"0131 Martin Luther King Day",

"0231 President's Day",

"0520 母亲节",

"0530 Armed Forces Day",

"0531 Victoria Day",

"0716 合作节",

"0730 被奴役国家周",

"0811 Civic Holiday",

"0911 Labor Holiday",

"1021 Columbus Day",

"1144 Thanksgiving")

/*****************************************************************************

日期计算

*****************************************************************************/

//====================================== 传回农历 y年的总天数

function lYearDays(y) {

var i, sum = 348

for(i=0x8000; i0x8; i=1) sum += (lunarInfo[y-1900] i)? 1: 0

return(sum+leapDays(y))

}

//====================================== 传回农历 y年闰月的天数

function leapDays(y) {

if(leapMonth(y)) return((lunarInfo[y-1900] 0x10000)? 30: 29)

else return(0)

}

//====================================== 传回农历 y年闰哪个月 1-12 , 没闰传回 0

function leapMonth(y) {

return(lunarInfo[y-1900] 0xf)

}

//====================================== 传回农历 y年m月的总天数

function monthDays(y,m) {

return( (lunarInfo[y-1900] (0x10000m))? 30: 29 )

}

//====================================== 算出农历, 传入日期物件, 传回农历日期物件

// 该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl

function Lunar(objDate) {

var i, leap=0, temp=0

var baseDate = new Date(1900,0,31)

var offset = (objDate - baseDate)/86400000

this.dayCyl = offset + 40

this.monCyl = 14

for(i=1900; i2050 offset0; i++) {

temp = lYearDays(i)

offset -= temp

this.monCyl += 12

}

if(offset0) {

offset += temp;

i--;

this.monCyl -= 12

}

this.year = i

this.yearCyl = i-1864

leap = leapMonth(i) //闰哪个月

this.isLeap = false

for(i=1; i13 offset0; i++) {

//闰月

if(leap0 i==(leap+1) this.isLeap==false)

{ --i; this.isLeap = true; temp = leapDays(this.year); }

else

{ temp = monthDays(this.year, i); }

//解除闰月

if(this.isLeap==true i==(leap+1)) this.isLeap = false

offset -= temp

if(this.isLeap == false) this.monCyl ++

}

if(offset==0 leap0 i==leap+1)

if(this.isLeap)

{ this.isLeap = false; }

else

{ this.isLeap = true; --i; --this.monCyl;}

if(offset0){ offset += temp; --i; --this.monCyl; }

this.month = i

this.day = offset + 1

}

//==============================传回国历 y年某m+1月的天数

function solarDays(y,m) {

if(m==1)

return(((y%4 == 0) (y%100 != 0) || (y%400 == 0))? 29: 28)

else

return(solarMonth[m])

}

//============================== 传入 offset 传回干支, 0=甲子

function cyclical(num) {

return(Gan[num%10]+Zhi[num%12])

}

//============================== 月历属性

function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {

this.isToday = false;

//国历

this.sYear = sYear;

this.sMonth = sMonth;

this.sDay = sDay;

this.week = week;

//农历

this.lYear = lYear;

this.lMonth = lMonth;

this.lDay = lDay;

this.isLeap = isLeap;

//干支

this.cYear = cYear;

this.cMonth = cMonth;

this.cDay = cDay;

this.color = '';

this.lunarFestival = ''; //农历节日

this.solarFestival = ''; //国历节日

this.solarTerms = ''; //节气

}

//===== 某年的第n个节气为几日(从0小寒起算)

function sTerm(y,n) {

var offDate = new Date( ( 31556925974.7*(y-1900) + sTermInfo[n]*60000 ) + Date.UTC(1900,0,6,2,5) )

return(offDate.getUTCDate())

}

//============================== 传回月历物件 (y年,m+1月)

function calendar(y,m) {

var sDObj, lDObj, lY, lM, lD=1, lL, lX=0, tmp1, tmp2

var lDPOS = new Array(3)

var n = 0

var firstLM = 0

sDObj = new Date(y,m,1) //当月一日日期

this.length = solarDays(y,m) //国历当月天数

this.firstWeek = sDObj.getDay() //国历当月1日星期几

for(var i=0;ithis.length;i++) {

if(lDlX) {

sDObj = new Date(y,m,i+1) //当月一日日期

lDObj = new Lunar(sDObj) //农历

lY = lDObj.year //农历年

lM = lDObj.month //农历月

lD = lDObj.day //农历日

lL = lDObj.isLeap //农历是否闰月

lX = lL? leapDays(lY): monthDays(lY,lM) //农历当月最后一天

if(n==0) firstLM = lM

lDPOS[n++] = i-lD+1

}

//sYear,sMonth,sDay,week,

//lYear,lMonth,lDay,isLeap,

//cYear,cMonth,cDay

this[i] = new calElement(y, m+1, i+1, nStr1[(i+this.firstWeek)%7],

lY, lM, lD++, lL,

cyclical(lDObj.yearCyl) ,cyclical(lDObj.monCyl), cyclical(lDObj.dayCyl++) )

if((i+this.firstWeek)%7==0) this[i].color = 'red' //周日颜色

if((i+this.firstWeek)%14==13) this[i].color = 'red' //周休二日颜色

}

//节气

tmp1=sTerm(y,m*2 )-1

tmp2=sTerm(y,m*2+1)-1

this[tmp1].solarTerms = solarTerm[m*2]

this[tmp2].solarTerms = solarTerm[m*2+1]

if(m==3) this[tmp1].color = 'red' //清明颜色

//国历节日

for(i in sFtv)

if(sFtv[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/))

if(Number(RegExp.$1)==(m+1)) {

this[Number(RegExp.$2)-1].solarFestival += RegExp.$4 + ' '

if(RegExp.$3=='*') this[Number(RegExp.$2)-1].color = 'red'

}

//月周节日

for(i in wFtv)

if(wFtv[i].match(/^(\d{2})(\d)(\d)([\s\*])(.+)$/))

if(Number(RegExp.$1)==(m+1)) {

tmp1=Number(RegExp.$2)

tmp2=Number(RegExp.$3)

this[((this.firstWeektmp2)?7:0) + 7*(tmp1-1) + tmp2 - this.firstWeek].solarFestival += RegExp.$5 + ' '

}

//农历节日

for(i in lFtv)

if(lFtv[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {

tmp1=Number(RegExp.$1)-firstLM

if(tmp1==-11) tmp1=1

if(tmp1 =0 tmp1n) {

tmp2 = lDPOS[tmp1] + Number(RegExp.$2) -1

if( tmp2 = 0 tmp2this.length) {

this[tmp2].lunarFestival += RegExp.$4 + ' '

if(RegExp.$3=='*') this[tmp2].color = 'red'

}

}

}

//黑色星期五

if((this.firstWeek+12)%7==5)

this[12].solarFestival += '黑色星期五 '

//今日

if(y==tY m==tM) this[tD-1].isToday = true;

}

//====================== 中文日期

function cDay(d){

var s;

switch (d) {

case 10:

s = '初十'; break;

case 20:

s = '二十'; break;

break;

case 30:

s = '三十'; break;

break;

default :

s = nStr2[Math.floor(d/10)];

s += nStr1[d%10];

}

return(s);

}

///////////////////////////////////////////////////////////////////////////////

var cld;

function drawCld(SY,SM) {

var i,sD,s,size;

cld = new calendar(SY,SM);

if(SY1874 SY1909) yDisplay = '光绪' + (((SY-1874)==1)?'元':SY-1874)

if(SY1908 SY1912) yDisplay = '宣统' + (((SY-1908)==1)?'元':SY-1908)

if(SY1911 SY1950) yDisplay = '民国' + (((SY-1911)==1)?'元':SY-1911)

// if(SY1949) yDisplay = '共和国' + (((SY-1949)==1)?'元':SY-1949)

// GZ.innerHTML = yDisplay +'年 农历' + cyclical(SY-1900+36) + '年   【'+Animals[(SY-4)%12]+'】';

if(SY1949) yDisplay = ''

GZ.innerHTML = yDisplay +' 农历' + cyclical(SY-1900+36) + '年   【'+Animals[(SY-4)%12]+'】';

YMBG.innerHTML = " " + SY + "BR " + monthName[SM];

for(i=0;i42;i++) {

sObj=eval('SD'+ i);

lObj=eval('LD'+ i);

sObj.className = '';

sD = i - cld.firstWeek;

if(sD-1 sDcld.length) { //日期内

sObj.innerHTML = sD+1;

if(cld[sD].isToday) sObj.className = 'todyaColor'; //今日颜色

sObj.style.color = cld[sD].color; //国定假日颜色

if(cld[sD].lDay==1) //显示农历月

lObj.innerHTML = 'b'+(cld[sD].isLeap?'闰':'') + cld[sD].lMonth + '月' + (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'小':'大')+'/b';

else //显示农历日

lObj.innerHTML = cDay(cld[sD].lDay);

s=cld[sD].lunarFestival;

if(s.length0) { //农历节日

if(s.length6) s = s.substr(0, 4)+'…';

s = s.fontcolor('red');

}

else { //国历节日

s=cld[sD].solarFestival;

if(s.length0) {

size = (s.charCodeAt(0)0 s.charCodeAt(0)128)?8:4;

if(s.lengthsize+2) s = s.substr(0, size)+'…';

s = s.fontcolor('blue');

}

else { //廿四节气

s=cld[sD].solarTerms;

if(s.length0) s = s.fontcolor('limegreen');

}

}

if(s.length0) lObj.innerHTML = s;

}

else { //非日期

sObj.innerHTML = '';

lObj.innerHTML = '';

}

}

}

function changeLong()

{

var y,m,ly,lm,id,im,iy,yangy,yangm,deltm,miny,tt;

CLD.SY.selectedIndex=CLD.D1.selectedIndex;

CLD.SM.selectedIndex=CLD.D2.selectedIndex;

yangm=0;yangy=0;

tt=true;

while (tt)

{

yangm=0;yangy=0;

changeCld();

for(i=0;i42;i++)

{

sD = i - cld.firstWeek;

if(sD-1 sDcld.length)

{ //日期内

if ((cld[sD].lMonth==CLD.D2.selectedIndex+1)(cld[sD].lYear==CLD.D1.selectedIndex+1900))

{

yangy=CLD.SY.selectedIndex+1900; yangm=CLD.SM.selectedIndex ;

tt=false;

break;

}

}

}

if (!tt) break;

pushBtm('MD');

changeCld();

// alert(CLD.SY.selectedIndex+" "+CLD.SM.selectedIndex);

for(i=0;i42;i++)

{

sD = i - cld.firstWeek;

if(sD-1 sDcld.length)

{ //日期内

if ((cld[sD].lMonth==CLD.D2.selectedIndex+1)(cld[sD].lYear==CLD.D1.selectedIndex+1900))

{

yangy=CLD.SY.selectedIndex+1900; yangm=CLD.SM.selectedIndex ;

tt=false;

break;

}

}

}

break;

}

// alert(yangy+" "+yangm);

//CLD.SY.selectedIndex=yangy;//-1900;

//pushBtm('YU');

//pushBtm('YD');

CLD.SM.selectedIndex=yangm;

pushBtm('MD');

pushBtm('MU');

}

//changeLong end

function changeCld() {

var y,m;

y=CLD.SY.selectedIndex+1900;

m=CLD.SM.selectedIndex;

drawCld(y,m);

}

function pushBtm(K) {

switch (K){

case 'YU' :

if(CLD.SY.selectedIndex0) CLD.SY.selectedIndex--;

break;

case 'YD' :

if(CLD.SY.selectedIndex149) CLD.SY.selectedIndex++;

break;

case 'MU' :

if(CLD.SM.selectedIndex0) {

CLD.SM.selectedIndex--;

}

else {

CLD.SM.selectedIndex=11;

if(CLD.SY.selectedIndex0) CLD.SY.selectedIndex--;

}

break;

case 'MD' :

if(CLD.SM.selectedIndex11) {

CLD.SM.selectedIndex++;

}

else {

CLD.SM.selectedIndex=0;

if(CLD.SY.selectedIndex149) CLD.SY.selectedIndex++;

}

break;

default :

CLD.SY.selectedIndex=tY-1900;

CLD.SM.selectedIndex=tM;

}

changeCld();

}

var Today = new Date();

var tY = Today.getFullYear();

var tM = Today.getMonth();

var tD = Today.getDate();

//////////////////////////////////////////////////////////////////////////////

var width = "130";

var offsetx = 2;

var offsety = 16;

var x = 0;

var y = 0;

var snow = 0;

var sw = 0;

var cnt = 0;

var dStyle;

document.onmousemove = mEvn;

//显示详细日期资料

function mOvr(v) {

var s,festival;

var sObj=eval('SD'+ v);

var d=sObj.innerHTML-1;

//sYear,sMonth,sDay,week,

//lYear,lMonth,lDay,isLeap,

//cYear,cMonth,cDay

if(sObj.innerHTML!='') {

sObj.style.cursor = 's-resize';

if(cld[d].solarTerms == '' cld[d].solarFestival == '' cld[d].lunarFestival == '')

festival = '';

else

festival = 'TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="#CCFFCC"TRTD'+

'FONT COLOR="#000000" STYLE="font-size:9pt;"'+cld[d].solarTerms + ' ' + cld[d].solarFestival + ' ' + cld[d].lunarFestival+'/FONT/TD'+

'/TR/TABLE';

s= 'TABLE WIDTH="130" BORDER=0 CELLPADDING="2" CELLSPACING=0 BGCOLOR="#000066"TRTD' +

'TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0TRTD ALIGN="right"FONT COLOR="#ffffff" STYLE="font-size:9pt;"'+

cld[d].sYear+' 年 '+cld[d].sMonth+' 月 '+cld[d].sDay+' 日br星期'+cld[d].week+'br'+

'font color="violet"农历'+(cld[d].isLeap?'闰 ':' ')+cld[d].lMonth+' 月 '+cld[d].lDay+' 日/fontbr'+

'font color="yellow"'+cld[d].cYear+'年 '+cld[d].cMonth+'月 '+cld[d].cDay + '日/font'+

'/FONT/TD/TR/TABLE'+ festival +'/TD/TR/TABLE';

document.all["detail"].innerHTML = s;

if (snow == 0) {

dStyle.left = x+offsetx-(width/2);

dStyle.top = y+offsety;

dStyle.visibility = "visible";

snow = 1;

}

}

}

日历代码

万年历代码:

iframe

src=""

width="509"

height=433

marginwidth="0"

marginheight="0"

hspace="0"

vspace="0"

frameborder="0"

scrolling="no"/iframe

老黄历的源代码:

IFRAME

style="BORDER-RIGHT:

#000000

1px

dotted;

BORDER-TOP:

#000000

1px

dotted;

BORDER-LEFT:

#000000

1px

dotted;

BORDER-BOTTOM:

#000000

1px

dotted"

border=0

name=nongli

marginHeight=0

src=""

frameBorder=no

width=149

scrolling=no

height=140/IFRAME

最新日历代码(包括日历、星期、现在时间)

IFRAME

border=0

name=www1.xise.cn

align=center

marginWidth=0

marginHeight=0

src=""

frameBorder=0

width=146

scrolling=no

height=183/IFRAME

代码一:IFRAME

style="BORDER-RIGHT:

#000000

1px

dotted;

BORDER-TOP:

#000000

1px

dotted;

BORDER-LEFT:

#000000

1px

dotted;

BORDER-BOTTOM:

#000000

1px

dotted"

border=0

name=nongli

marginHeight=0

src=""

frameBorder=no

width=149

scrolling=no

height=140/IFRAME

代码二:iframe

name="jiro23"

src=""

width="500"

height="500"/iframe

代码三:iframe

scrolling=no

height=170

width=165

frameborder=0

marginHeight=0

marginWidth=0

src=;/iframe

具体步骤是:复制代码---管理博客-----新增空白面板-----钩选显示源代码(出现钩号,同时文档里出现DIV的字样)----粘贴代码----钩选显示源代码(钩号消失)-----保存新增面板----定制个人首页----选取新增个人面板----保存设置

网站日历代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于中国日历网址、网站日历代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/1543.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载