<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>日期时间脚本显示</title>
</head>
<body bgcolor="#AED5E8"><center>
日期时间脚本显示<p><hr>
<!-- 第一种形式 -->
<div align="center">
<SCRIPT language=JavaScript>
<!--
var noon;
var time=new Date();
var hour=time.getHours();
var minute=time.getMinutes();
var today=new Date;
var week=new Array(7);
week[0]="天";
week[1]="一";
week[2]="二";
week[3]="三";
week[4]="四";
week[5]="五";
week[6]="六";
if (hour<5) noon="凌晨";
if (hour>4 & hour<8) noon="早晨";
if (hour>7 & hour<12) noon="上午";
if (hour==12) noon="中午";
if (hour>12 & hour<19) noon="下午";
if (hour>18 & hour<23) noon="晚上";
if (hour>22) noon="深夜";
if (hour>12) hour=hour-12;
if (hour<10) hour="0"+hour;
if (minute<10) minute="0"+minute;
document.write("<span class='p9'>");
document.write(today.getYear()+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日 星期"+week[today.getDay()]+" "+"北京时间:"+noon+" "+hour+":"+minute+" ");
document.write("</span>");
//-->
</SCRIPT>
</div>
<p><hr>
<!-- 第二种形式 -->
<FONT color=#f8941f>
<SCRIPT language=JavaScript>
<!--
// Begin
document.write("今天是:")
var enable=0; today=new Date();
var day; var date;
var time_start = new Date();
var clock_start = time_start.getTime();
if(today.getDay()==0) day="星期日"
if(today.getDay()==1) day="星期一"
if(today.getDay()==2) day="星期二"
if(today.getDay()==3) day="星期三"
if(today.getDay()==4) day="星期四"
if(today.getDay()==5) day="星期五"
if(today.getDay()==6) day="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日 ";
document.write(date+day);
// -->
</SCRIPT><br>
<SCRIPT language=JavaScript>
<!--
var mess1="你正在登陆的是:逍湘个人网!";
var mess2= "你正在登陆的是:逍湘个人网!"
day = new Date( )
hr = day.getHours( )
if (( hr >=0 ) && (hr <= 4 ))
mess1= "夜深了,逍湘提醒您要注意身体哦..."
if (( hr >= 4 ) && (hr < 7))
mess1=" 清晨好,您可真早呀!吃早餐了吗?"
if (( hr >= 7 ) && (hr < 12))
mess1=" 上午好,您开始工作了? "
if (( hr >= 12) && (hr <= 19))
mess1= "下午好,您工作辛苦了!"
if ((hr >= 19) && (hr <= 23))
mess1= "晚上好,您真是分秒必争呀! "
document.write("<blink>")
document.write(mess1)
document.write("</blink>")
document.write(mess2)
// -->
</SCRIPT>
</FONT>
<p><hr>
<!-- 第三种形式 -->
<div id="clock" ></div>
<SCRIPT language=Javascript1.2>
<!--
function show() {
if(!document.layers && !document.all) return;
var d = new Date();
var iYear = d.getYear()
var iMonth = d.getMonth()
var iDay = d.getDate()
var sWeek = d.getDay()
var sHour = d.getHours()
var sMinute = d.getMinutes()
var sSecond = d.getSeconds()
if(sWeek == 0) sWeek = "<font color=#ffffff>星期天</font>";
if(sWeek == 1) sWeek = "星期一";
if(sWeek == 2) sWeek = "星期二";
if(sWeek == 3) sWeek = "星期三";
if(sWeek == 4) sWeek = "星期四";
if(sWeek == 5) sWeek = "星期五";
if(sWeek == 6) sWeek = "<font color=#ffffff>星期六</font>";
if(sHour <= 9) sHour = "0" + sHour;
if(sMinute <= 9) sMinute = "0" + sMinute;
if(sSecond <= 9) sSecond = "0" + sSecond;
sClock = " " + iYear + "年" + (iMonth + 1) + "月" + iDay + "日 " + sWeek
+ " " + sHour + ":" + sMinute + ":" + sSecond;
if(document.layers) {
document.layers.clock.document.write(sClock);
document.layers.clock.document.close();
}
else if(document.all)
clock.innerHTML = sClock;
setTimeout("show()", 1000);
}
show();
//-->
</SCRIPT>
<p><hr>
<!-- 第四种形式 -->
<FONT color=#ff0033>
<DIV id=jnkc></DIV>
<SCRIPT>
setInterval("jnkc.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt (new Date().getDay());",1000);
</SCRIPT>
</FONT>
<p><hr>
</center>
</body>
</html>
|