编辑主页 > 列表 > 正文
日期时间周代码
作者:eye 发布时间:2020/09/25 15:55:13 分数:0 跟帖:3
1、日期时间周<table width="96%" border="0" cellspacing="0" cellpadding="0"><tr><td width="10%" class="redfont red"><div align="center">今天是:</div></td><td width="78%" class="redfont red"><script language="javascript">function showTime(){var oDiv = document.all('oDiv');var oDate = new Date();var strTime = oDate.getFullYear() + '年' + eval(oDate.getMonth()+1) + '月' + oDate.getDate() + '日 星期' + '日一二三四五bai六'.substr(oDate.getDay(),1) + ' ' + oDate.getHours() + ':' + oDate.getMinutes() + ':' + oDate.getSeconds();oDiv.innerHTML = strTime;window.setTimeout('showTime()', 1000);}window.onload = showTime;</script><div id="oDiv"></div></td></tr></table>


网友跟帖 共3 条 [我也要发表回复]
删除回复eye - 回复于2020/9/25 15:55:46
1
2、日期时间周<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><body><div id="time"></div><script language="javascript" type="text/javascript">function setTime(){var dt=new Date();var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");var strWeek=arr_week[dt.getDay()];var strHour=dt.getHours();var strMinutes=dt.getMinutes();var strSeconds=dt.getSeconds();if (strMinutes<10) strMinutes="0"+strMinutes;if (strSeconds<10) strSeconds="0"+strSeconds;var strYear=dt.getFullYear()+"年";var strMonth=(dt.getMonth()+1)+"月";var strDay=dt.getDate()+"日";var strTime=strHour+":"+strMinutes+":"+strSeconds;time.innerHTML="现在是:"+strYear+strMonth+strDay+" "+strTime+"  "+strWeek; /* time是dao面DIV的ID值,看要把它放在网页哪边可以换了*/}setInterval("setTime()",1000);/* 这个是跳动函数,后面是多久跳以毫秒,1000就是一秒跳动 */</script></body></html>
删除回复eye - 回复于2020/9/25 15:56:07
2
3、年月日周<%week=weekday(now)if week=1 thenweek="一"elseif week=2 thenweek="二"elseif week=3 thenweek="三"elseif week=4 thenweek="四"elseif week=5 thenweek="五"elseif week=6 thenweek="六"elseif week=7 thenweek="日"end ifhours=hour(now)if hours >=5 and hours < 11 thenhours="早上好!"elseif hours >=11 and hours < 13 thenhours="中午好!"elseif hours >=13 and hours < 16 thenhours="下午好!"elseif hours >=16 and hours < 18 thenhours="傍晚好!"elseif hours >=18 and hours < 23 thenhours="晚上好!"elseif hours >=23 or hours < 5 thenhours="深更半夜的 该睡觉了!"end ifresponse.write year(now)&"年"&month(now)&"月"&day(now)&"日 星期"&week&" "&hour(now)&"点"&minute(now)&"分"&second(now)&"秒 "response.write hours%>
删除回复eye - 回复于2020/9/25 15:56:41
3
4、日期时间<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>JavaScript 时间显示</title></head><body><span id=localtime></span><script type="text/javascript">function showLocale(objD){ var str,colorhead,colorfoot; var yy = objD.getYear(); if(yy<1900) yy = yy+1900; var MM = objD.getMonth()+1; if(MM<10) MM = '0' + MM; var dd = objD.getDate(); if(dd<10) dd = '0' + dd; var hh = objD.getHours(); if(hh<10) hh = '0' + hh; var mm = objD.getMinutes(); if(mm<10) mm = '0' + mm; var ss = objD.getSeconds(); if(ss<10) ss = '0' + ss; var ww = objD.getDay(); if  ( ww==0 )  colorhead="<font color="#FF0000">"; if  ( ww > 0 && ww < 6 )  colorhead="<font color="#373737">"; if  ( ww==6 )  colorhead="<font color="#008000">"; if  (ww==0)  ww="星期日"; if  (ww==1)  ww="星期一"; if  (ww==2)  ww="期二"; if  (ww==3)  ww="星期三"; if  (ww==4)  ww="星期四"; if  (ww==5)  ww="星期五"; if  (ww==6)  ww="星期六"; colorfoot="</font>" str = colorhead + yy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss + "  " + ww + colorfoot; return(str);}function tick(){ var today; today = new Date(); document.getElementById("localtime").innerHTML = showLocale(today); window.setTimeout("tick()", 1000);}tick();</script></body></html>
版区推荐 >>
广告区