在网页中加上年月日、时间的代码
发布网友
发布时间:2022-04-22 16:11
我来回答
共3个回答
热心网友
时间:2023-10-21 04:40
<!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是上面DIV的ID值,看要把它放在网页哪边可以换了*/
}
setInterval("setTime()",1000);/* 这个是跳动函数,后面是多久跳以毫秒,1000就是一秒跳动 */
</script>
</body>
</html>
热心网友
时间:2023-10-21 04:41
<%
week=weekday(now)
if week=1 then
week="一"
elseif week=2 then
week="二"
elseif week=3 then
week="三"
elseif week=4 then
week="四"
elseif week=5 then
week="五"
elseif week=6 then
week="六"
elseif week=7 then
week="日"
end if
hours=hour(now)
if hours >=5 and hours < 11 then
hours="早上好!"
elseif hours >=11 and hours < 13 then
hours="中午好!"
elseif hours >=13 and hours < 16 then
hours="下午好!"
elseif hours >=16 and hours < 18 then
hours="傍晚好!"
elseif hours >=18 and hours < 23 then
hours="晚上好!"
elseif hours >=23 or hours < 5 then
hours="深更半夜的 该睡觉了!"
end if
response.write year(now)&"年"&month(now)&"月"&day(now)&"日 星期"&week&" "&hour(now)&"点"&minute(now)&"分"&second(now)&"秒 "
response.write hours
%>
热心网友
时间:2023-10-21 04:41
我觉得可以用flash做一个 挺简单的, 需要的话百度HI我