网页上的日期台历
|
admin
2010年3月6日 0:29
本文热度 11563
|
这也是一款在网页上显示日期时间的javascript代码,可以显示现在时间、年、月、日以及星期几等。不同的是,它的样式像一个小台历一样,很漂亮,每天都会提醒你今天是几月几日,是不是很方便,也很美观。
[code][br][br]
网页上的日期台历[br] [br][br][br]<script language=javascript>[br]function year_month(){ [br]var now = new date(); [br]var yy = now.getyear(); [br]var mm = now.getmonth()+1; [br]var cl = '
'; [br]if (now.getday() == 0) cl = ''; [br]if (now.getday() == 6) cl = ''; [br]return(cl + yy + '年' + mm + '月'); }[br]function date_of_today(){ [br]var now = new date(); [br]var cl = ''; [br]if (now.getday() == 0) cl = ''; [br]if (now.getday() == 6) cl = ''; [br]return(cl + now.getdate() + ''); }[br]function day_of_today(){ [br]var day = new array(); [br]day[0] = "星期日"; [br]day[1] = "星期一"; [br]day[2] = "星期二"; [br]day[3] = "星期三"; [br]day[4] = "星期四"; [br]day[5] = "星期五"; [br]day[6] = "星期六"; [br]var now = new date();[br]///[br]var cl = ''; [br]if (now.getday() == 0) cl = ''; [br]if (now.getday() == 6) cl = ''; [br]return(cl + day[now.getday()] + ''); }[br]function curenttime(){ [br]var now = new date(); [br]var hh = now.gethours(); [br]var mm = now.getminutes(); [br]var ss = now.gettime() % 60000; [br]ss = (ss - (ss % 1000)) / 1000; [br]var clock = hh+':'; [br]if (mm < 10) clock += '0'; [br]clock += mm+':'; [br]if (ss < 10) clock += '0'; [br]clock += ss; [br]return(clock); } [br]function refreshcalendarclock(){ [br]document.all.calendarclock1.innerhtml = year_month(); [br]document.all.calendarclock2.innerhtml = date_of_today(); [br]document.all.calendarclock3.innerhtml = day_of_today(); [br]document.all.calendarclock4.innerhtml = curenttime(); }[br]var weburl = weburl; [br]document.write(''); [br]document.write(''); [br]document.write('');[br]document.write('');[br]document.write('');[br]document.write('');[br]document.write(' ');[br]document.write(' ');[br]document.write(' ');[br]document.write('');[br]document.write(' | ');[br]document.write(' | '); [br]document.write(' |
'); [br]setinterval('refreshcalendarclock()',1000);[br]</script>[br][br][/code]
该文章在 2010/3/6 0:29:23 编辑过