管理员登陆

停止 继续 暂停 收听本文

JavaScript显示时间日期

<script type="text/javascript"> 
today=new Date();
var day; var date; var hello;
hour=new Date().getHours()
if(hour < 6)hello=' <span style="float: right;">凌晨好! 不要熬夜了。</span>'
else if(hour < 9)hello=' <span style="float: right;">早上好!记得吃早餐。 </span>'
else if(hour < 12)hello=' <span style="float: right;">上午好!好好工作哦。 </span>'
else if(hour < 14)hello=' <span style="float: right;">中午好! 要睡中午觉。</span>'
else if(hour < 17)hello=' <span style="float: right;">下午好! </span>'
else if(hour < 19)hello=' <span style="float: right;">傍晚好! </span>'
else if(hour < 22)hello=' <span style="float: right;">晚上好! </span>'
else {hello='<span style="float: right;">夜深了!该休息了。</span>'}
var webUrl = webUrl;
document.write(' '+hello);
</script> 
<span id="localtime" style="float: right;margin-right: 20px;"> 
		<script type="text/javascript">
			function localtime() {
				var vWeek, vWeek_s, vDay;
				vWeek = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
				var date =  new Date();
				year = date.getFullYear();
				month = date.getMonth() + 1;
				day = date.getDate();
				hours = date.getHours();
				minutes = date.getMinutes();
				seconds = date.getSeconds();
				vWeek_s = date.getDay();
				document.getElementById("localtime").innerHTML = year + "年" + month + "月" + day + "日" + "\t" + hours + ":" + minutes + ":" + seconds + "\t" + vWeek[vWeek_s];
 
			};
			setInterval("localtime()", 1000);
		</script>

信息科技 2011-01-12 00:14:54 通过 网页 浏览(2853) 打印

上一篇

上一篇文章

共有0条评论!

发表评论