很齐全的HTML时间代码.docx

上传人:b****5 文档编号:12218695 上传时间:2023-04-17 格式:DOCX 页数:53 大小:34.73KB
下载 相关 举报
很齐全的HTML时间代码.docx_第1页
第1页 / 共53页
很齐全的HTML时间代码.docx_第2页
第2页 / 共53页
很齐全的HTML时间代码.docx_第3页
第3页 / 共53页
很齐全的HTML时间代码.docx_第4页
第4页 / 共53页
很齐全的HTML时间代码.docx_第5页
第5页 / 共53页
点击查看更多>>
下载资源
资源描述

很齐全的HTML时间代码.docx

《很齐全的HTML时间代码.docx》由会员分享,可在线阅读,更多相关《很齐全的HTML时间代码.docx(53页珍藏版)》请在冰豆网上搜索。

很齐全的HTML时间代码.docx

很齐全的HTML时间代码

很齐全的HTML时间代码.txt10有了执著,生命旅程上的寂寞可以铺成一片蓝天;有了执著,孤单可以演绎成一排鸿雁;有了执著,欢乐可以绽放成满圆的鲜花。

--网页加载时调用一次以后就自动调用了-->

 

实时走动的数字时钟如:

下午14:

15:

00

第一步:

在区域加入以下代码

XML/HTML代码

复制代码

 

第二步.将下面的代码加入html文件任意需要的地方

1.

20;color:

#000000">

复制代码

你可以自行更改样式!

二、显示年月日格式的时间代码如:

2008年11月27日星期四

XML/HTML代码

1.

2.today=newDate();

3.functioninitArray(){

4.this.length=initArray.arguments.length

5.for(vari=0;i

6.this[i+1]=initArray.arguments[i]}

7.vard=newinitArray(

8."星期日",

9."星期一",

10."星期二",

11."星期三",

12."星期四",

13."星期五",

14."星期六");

15.document.write(

16."

9pt;font-family:

宋体'>",

17.today.getYear(),"年",

18.today.getMonth()+1,"月",

19.today.getDate(),"日",

20.d[today.getDay()+1],

21."");

22.

复制代码

 

三、显示日期,星期,时间格式的代码如:

2008年11月27日星期四下午2:

17:

36

XML/HTML代码

1.

 

2.

 

3.

4.today=newDate();

5.functioninitArray(){

6.this.length=initArray.arguments.length

7.for(vari=0;i

8.this[i+1]=initArray.arguments[i]}

9.vard=newinitArray(

10."星期日",

11."星期一",

12."星期二",

13."星期三",

14."星期四",

15."星期五",

16."星期六");

17.document.write(

18."

9pt;font-family:

宋体'>",

19.today.getYear(),"年",

20.today.getMonth()+1,"月",

21.today.getDate(),"日",

22.d[today.getDay()+1],

23."");

24.

25.

26.

27.

28.

29.functiontick(){

30.varhours,minutes,seconds,xfile;

31.varintHours,intMinutes,intSeconds;

32.vartoday;

33.today=newDate();

34.intHours=today.getHours();

35.intMinutes=today.getMinutes();

36.intSeconds=today.getSeconds();

37.if(intHours==0){

38.hours="12:

";

39.xfile="午夜";

40.}elseif(intHours<12){

41.hours=intHours+":

";

42.xfile="上午";

43.}elseif(intHours==12){

44.hours="12:

";

45.xfile="正午";

46.}else{

47.intHours=intHours-12

48.hours=intHours+":

";

49.xfile="下午";

50.}

51.if(intMinutes<10){

52.minutes="0"+intMinutes+":

";

53.}else{

54.minutes=intMinutes+":

";

55.}

56.if(intSeconds<10){

57.seconds="0"+intSeconds+"";

58.}else{

59.seconds=intSeconds+"";

60.}

61.timeString=xfile+hours+minutes+seconds;

62.Clock.innerHTML=timeString;

63.window.setTimeout("tick();",100);

64.}

65.window.onload=tick;

66.

67.

12px;COLOR:

#ecc1c1"align=center>

复制代码

 

四、显示来访者的停留时间如:

停留时间:

00:

15

XML/HTML代码

1.

 

2.

 

3.

4.varap_name=navigator.appName;

5.varap_vinfo=navigator.appVersion;

6.varap_ver=parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf('(')));

7.

8.vartime_start=newDate();

9.varclock_start=time_start.getTime();

10.vardl_ok=false;

11.

12.functioninit()

13.{

14.if(ap_name=="Netscape"&&ap_ver>=3.0)

15.dl_ok=true;

16.returntrue;

17.}

18.

19.functionget_time_spent()

20.{

21.vartime_now=newDate();

22.return((time_now.getTime()-clock_start)/1000);

23.}

24.

25.functionshow_secs()//showthetimeuserspentontheside

26.{

27.vari_total_secs=Math.round(get_time_spent());

28.vari_secs_spent=i_total_secs%60;

29.vari_mins_spent=Math.round((i_total_secs-30)/60);

30.vars_secs_spent=""+((i_secs_spent>9)?

i_secs_spent:

"0"+i_secs_spent);

31.vars_mins_spent=""+((i_mins_spent>9)?

i_mins_spent:

"0"+i_mins_spent);

32.document.fm0.time_spent.value=s_mins_spent+":

"+s_secs_spent;

33.window.setTimeout('show_secs()',1000);

34.}

35.

36.//-->

37.

38.停留时间:

39.

复制代码

而且还要在你主页源文件中加入下面的代码

1.

复制代码

 

五、显示当前日期与时间如:

现在是:

2008年11月27日14:

18:

59时间不走动

XML/HTML代码

1.

 

2.

 

3.

4.

--

5.now=newDate()

6.hour=now.getHours()

7.if(hour<12){

8.document.write("现在是:

"+now.toLocaleString())

9.}elseif(hour<18){

10.document.write("现在是:

"+now.toLocaleString())

11.}elseif(hour>=18){

12.document.write("现在是:

"+now.toLocaleString())

13.}

14.//-->

复制代码

 

六、浏览器状态栏显示的时钟如:

2:

20P.M.星期四在状态栏显示

XML/HTML代码

1.

 

2.

 

3.

4.

5.

--Hide

6.timeID=null;

7.timeRunning=false;

8.functionstop(){

9.if(timeRunning)

10.clearTimeout(timeID);

11.timeRunning=false;

12.}

13.functiontime(){

14.tick=newDate();

15.hours=tick.getHours();

16.minutes=tick.getMinutes();

17.seconds=tick.getSeconds();

18.day=tick.getDay();

19.month=tick.getMonth();

20.date=tick.getDate();

21.year=tick.getYear();

22.current=""+((hours>12)?

hours-12:

hours)

23.current+=((minutes<10)?

":

0":

":

")+minutes

24.current+=((seconds<10)?

":

0":

":

")+seconds

25.current+=(hours>=12)?

"P.M.":

"A.M."

26.if(day==0){varweekday="星期日"}

27.if(day==1){varweekday="星期一"}

28.if(day==2){varweekday="星期二"}

29.if(day==3){varweekday="星期三"}

30.if(day==4){varweekday="星期四"}

31.if(day==5){varweekday="星期五"}

32.if(day==6){varweekday="星期六"}

33.current+=(weekday)

34.window.status=current;

35.timeID=setTimeout("time()",1000);

36.timeRunning=true;

37.}

38.functionrun(){

39.stop();

40.time();

41.}

42.

43.//-->

44.

复制代码

 

七、显示最后更新时间代码如:

最后更新时间:

11/27/200814:

21:

04

XML/HTML代码

1.

 

2.

 

3.

4.

--hidescriptfromoldbrowsers

5.document.write("最后更新时间:

"+document.lastModified+"")

6.//endhiding-->

7.

复制代码

相关帖子

*征服RIA:

函数式编程的原理

收藏分享

0

*0

*0

*顶

*踩

本是后山人;偶作前堂客。

醉舞经阁半卷书;坐井说天阔。

大志戏功名;海斗量福祸。

待到囊中羞涩时;怒指乾坤错。

最快的美国主机,支持支付宝付款,中文面板,无限网站!

分享到:

人人网QQ空间XX收藏开心网新浪微博Google书签

lht272

*发短消息

*加为好友

lht272(百科“砖”家)当前离线

UID

1728

帖子

11276

精华

2

积分

12831

阅读权限

100

来自

山沟

在线时间

2374小时

注册时间

2009-1-14

最后登录

2010-12-14

个人空间查看详细资料

版主

Rank:

7Rank:

7Rank:

7

帖子

11276

精华

2

积分

12831

威望

307

银币

42055

金币

12647

来自

山沟

在线时间

2374小时

注册时间

2009-1-14

优秀版主

2#

发表于2010-9-1021:

14|只看该作者

八、实时走动的数字时钟如:

下午14:

22:

03

XML/HTML代码

1.

40.

41.

20;color:

#000000">

复制代码

 

九、根据不同的时间显示不同的问候语如:

午安!

XML/HTML代码

方法:

在主页中你需要的地方加入以下代码:

1.

 

2.

 

3.

4.now=newDate(),hour=now.getHours()

5.if(hour<6){document.write("明天不用上班了吗?

")}

6.elseif(hour<8){document.write("全新的一天!

")}

7.elseif(hour<12){document.write("早安!

")}

8.elseif(hour<14){document.write("外面太阳大吗?

")}

9.elseif(hour<18){document.write("午安!

")}

10.elseif(hour<22){document.write("晚上好!

")}

11.elseif(hour<24){document.write("夜深了!

要注意身体呀!

祝你做个好梦!

")}

12.//-->

13.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科 > 广告传媒

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1