网页时间制作代码Word格式文档下载.docx
- 文档编号:5892634
- 上传时间:2023-05-05
- 格式:DOCX
- 页数:35
- 大小:23.73KB
网页时间制作代码Word格式文档下载.docx
《网页时间制作代码Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《网页时间制作代码Word格式文档下载.docx(35页珍藏版)》请在冰点文库上搜索。
5月"
6月"
7月"
8月"
10月"
11月"
12月"
varlinkcount=0;
functionaddlink(month,day,href){
varentry=newArray(3);
entry[0]=month;
entry[1]=day;
entry[2]=href;
this[linkcount++]=entry;
}
Array.prototype.addlink=addlink;
linkdays=newArray();
monthdays=newArray(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
todayDate=newDate();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear=thisyear%100;
thisyear=((thisyear<
50)?
(2000+thisyear):
(1900+thisyear));
if(((thisyear%4==0)
&
!
(thisyear%100==0))
||(thisyear%400==0))monthdays[1]++;
startspaces=thisdate;
while(startspaces>
7)startspaces-=7;
startspaces=thisday-startspaces+1;
if(startspaces<
0)startspaces+=7;
document.write("
tableborder=2bgcolor=white"
bordercolor=black>
fontcolor=black>
tr>
tdcolspan=7>
center>
+thisyear
+"
+monthnames[thismonth]+"
/center>
/td>
/tr>
tdalign=center>
日<
一<
二<
三<
四<
五<
六<
for(s=0;
s<
startspaces;
s++){
td>
nbsp<
count=1;
while(count<
=monthdays[thismonth]){
for(b=startspaces;
b<
7;
b++){
linktrue=false;
for(c=0;
c<
linkdays.length;
c++){
if(linkdays[c]!
=null){
if((linkdays[c][0]==thismonth+1)&
(linkdays[c][1]==count)){
ahref=\"
+linkdays[c][2]+"
\"
linktrue=true;
if(count==thisdate){
fontcolor='
FF0000'
strong>
if(count<
document.write(count);
else{
nbsp"
/strong>
if(linktrue)
/a>
count++;
startspaces=0;
/table>
/p>
//End-->
状态栏滚动时钟
SCRIPTLANGUAGE="
varosd="
osd+="
;
vartimer;
varmsg="
functionscrollMaster(){
msg=customDateSpring(newDate())
clearTimeout(timer)
msg+="
+showtime()+"
+osd
for(vari=0;
i<
100;
i++){
msg="
+msg;
scrollMe()
functionscrollMe(){
window.status=msg;
msg=msg.substring(1,msg.length)+msg.substring(0,1);
timer=setTimeout("
scrollMe()"
200);
functionshowtime(){
varnow=newDate();
varhours=now.getHours();
varminutes=now.getMinutes();
varseconds=now.getSeconds();
varmonths=now.getMonth();
vardates=now.getDate();
varyears=now.getYear();
vartimeValue="
timeValue+=((months>
9)?
:
)
timeValue+=((dates>
timeValue=(months+1)
timeValue+="
/"
+dates
+years
varap="
A.M."
if(hours==12){
ap="
P.M."
if(hours==0){
hours=12
if(hours>
=13){
hours-=12;
ap="
vartimeValue2="
+hours
timeValue2+=((minutes<
10)?
:
0"
)+minutes+"
+ap
returntimeValue2;
functionMakeArray(n){
this.length=n
returnthis
monthNames=newMakeArray(12)
monthNames[1]="
一月"
monthNames[2]="
二月"
monthNames[3]="
三月"
monthNames[4]="
四月"
monthNames[5]="
五月"
monthNames[6]="
六月"
monthNames[7]="
七月"
monthNames[8]="
八月"
monthNames[9]="
九月"
monthNames[10]="
十月"
monthNames[11]="
十一月"
monthNames[12]="
十二月"
daysNames=newMakeArray(7)
daysNames[1]="
周日"
daysNames[2]="
周一"
daysNames[3]="
周二"
daysNames[4]="
周三"
daysNames[5]="
周四"
daysNames[6]="
周五"
daysNames[7]="
周六"
functioncustomDateSpring(oneDate){
vartheDay=daysNames[oneDate.getDay()+1]
vartheDate=oneDate.getDate()
vartheMonth=monthNames[oneDate.getMonth()+1]
vardayth="
号"
if((theDate==1)||(theDate==21)||(theDate==31)){
dayth="
st"
if((theDate==2)||(theDate==22)){
nd"
if((theDate==3)||(theDate==23)){
rd"
returntheDay+"
"
+theMonth+"
+theDate+dayth+"
"
scrollMaster();
/SCRIPT>
8种形式显示当前日期
--第一步:
把如下代码加入<
head>
区域中-->
SCRIPTlanguage=javascriptauthor=luxiaoqing>
--
functioninitArray(){for(i=0;
initArray.arguments.length;
this[i]=initArray.arguments[i];
}varisnMonths=newinitArray("
9月"
varisnDays=newinitArray("
today=newDate();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh="
+((hrs>
12)?
hrs-12:
hrs);
clckm=((min<
10)?
)+min;
clcks=((sec<
)+sec;
clck=(hrs>
=12)?
下午"
上午"
varstnr="
varns="
0123456789"
vara="
//-->
--第二步:
body>
SCRIPTlanguage=javascript>
functiongetFullYear(d){//disadateobject
yr=d.getYear();
if(yr<
1000)
yr+=1900;
returnyr;
}document.write("
tablewidth=486>
//don'
tdeletethisline
/*每一段代表一种风格,不需要的删除即可*/
TR>
TDVALIGN=TOP>
P>
风格一<
/TD>
+isnDays[today.getDay()]
+isnMonths[today.getMonth()]+"
+today.getDate()+"
日,"
+getFullYear(today)+"
年<
风格二<
+clckh+"
+clckm
+clcks+"
+clck+"
/TR>
风格三<
+isnDays[today.getDay()]+"
年"
+clckm+"
风格四<
+(today.getMonth()+1)+"
+(getFullYear(today)+"
).substring(2,4)+"
风格五:
+hrs+"
风格六:
TD>
+today+"
风格七<
+navigator.appName+"
风格八:
+navigator.appVersion+"
//don'
标题栏时钟
varclocktext,timeday;
varpagetitle=document.title;
functionscroll(){
today=newDate();
sec=today.getSeconds();
hr=today.getHours();
min=today.getMinutes();
if(hr<
12){timeday="
AM"
}
else{timeday="
PM"
if(hr>
12)hr=hr-12;
=9)hr="
+hr;
if(min<
=9)min="
+min;
if(sec<
=9)sec="
+sec;
varclocktext="
-"
+hr+"
+min+"
+sec+timeday;
clocktimer=setTimeout("
scroll()"
1000);
document.title=pagetitle+clocktext;
if(document.all)scroll();
不同时间显示不同问候
varmess1="
varmess2="
欢迎光临!
b>
day=newDate()
hr=day.getHours()
if((hr>
=0)&
(hr<
=4))
mess1="
深夜了,注意身体哦..."
=4)&
7))
清晨好,起得真早啊..."
=7)&
12))
早上好,"
=12)&
=13))
午饭时间喔,"
=13)&
=17))
外面的太阳猛烈吗?
=17)&
=18))
进入傍晚了,"
if((hr>
=18)&
=19))
我大概在吃晚饭了,"
=19)&
=23))
又到晚上黄金上网时间了,"
document.write(mess1)
document.write(mess2)
/b>
//--->
查见网站的更新时间
--先打开一个网站,然后将下面代码替换地址栏上的网址(包括HTTP:
//)-->
javascript:
alert(document.lastModified)
纯钟
pX=400;
pY=200
obs=newArray(13)
functionob(){
for(i=0;
i<
13;
i++){
if(document.all)obs[i]=newArray(eval('
ob'
+i).style,-100,-100)
elseobs[i]=newArray(eval('
document.ob'
+i),-100,-100)
functioncl(a,b,c){
if(document.all){
if(a!
=0)b+=-1
eval('
c'
+a+'
.style.pixelTop='
+(pY+(c)))
.style.pixelLeft='
+(pX+(b)))
else{
=0)b+=10
document.c'
.top='
.left='
if(document.all)c0.style.pixelLeft=26
functionrunClock(){
for(i=0;
obs[i][0].left=obs[i][1]+pX
obs[i][0].top=obs[i][2]+pY
varlastsec
functiontimer(){
time=newDate()
sec=time.getSeconds()
if(sec!
=lastsec){
lastsec=sec
sec=Math.PI*sec/30
min=Math.PI*time.getMinutes()/30
hr=Math.PI*((time.getHours()*60)+time.getMinutes())/360
for(i=1;
6;
i++){
obs[i][1]=Math.sin(sec)*(44-(i-1)*11)-16;
if(document.layers)obs[i][1]+=10;
obs[i][2]=-Math.cos(sec)*(44-(i-1)*11)-27;
for(i=6;
10;
obs[i][1]=Math.sin(min)*(40-(i-6)*10)-16;
obs[i][2]=-Math.cos(min)*(40-(i-6)*10)-27;
for(i=10;
obs[i][1]=Math.sin(hr)*(37-(i-10)*11)-16;
obs[i][2]=-Math.cos(hr)*(37-(i-10)*11)-27;
functionsetNum(){
cl(0,-67,-65);
cl(1,10,-51);
cl(2,28,-33);
cl(3,35,-8);
cl(4,28,17);
cl(5,10,35);
cl(
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 网页 时间 制作 代码