js显示当前系统时间
<!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>JS显示当前时间三种显示方式-懒人建站</title>
<meta
name="keywords" content="网页特效,网页模板,导航菜单,焦点幻灯片,JS代码" />
<meta
name="description"
content="懒人建站为您提供-HTML+CSS模板,JS广告代码,网页特效,导航菜单,焦点幻灯片代码,原创视频教程与网页模板和CSS技巧。"
/>
</head>
<body>
<script
language=JavaScript>
<!--
var enabled = 0; today = new
Date();
var day; var date;
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 = "
星期六"
document.fgColor = "000000";
date = "今天是:" + (today.getYear()) + "年"
+ (today.getMonth() + 1 ) + "月" + today.getDate() + "日" + day
+"";
document.write(date);
//
-->
</script>
<hr>
<div
id="webjx"></div>
<hr>
<script>setInterval("webjx.innerHTML=new
Date().toLocaleString()+‘ 星期‘+‘日一二三四五六‘.charAt(new
Date().getDay());",1000);
</script>
<span id=nowDate></span>
<span
id=nowTime></span>
<script><!--
var ns4up1 =
(document.layers) ? 1 : 0; // browser sniffer
var ie4up1 = (document.all&&(navigator.appVersion.indexOf("MSIE 4") == -1)) ? 1 : 0;
var ns6up1 = (document.getElementById&&!document.all) ? 1 : 0;
function nowclock() {
if (!ns4up1 && !ie4up1 && !ns6up1)
return false;
var digital = new Date();
var hours =
digital.getHours();
var minutes = digital.getMinutes();
var seconds =
digital.getSeconds();
var day = digital.getDate();
var month =
digital.getMonth() + 1;
var year = digital.getYear();
var amOrPm =
"AM";
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours -
12;
if (hours == 0) hours = 12;
if (minutes < 10) minutes = "0" +
minutes;
if (seconds < 10) seconds = "0" + seconds;
if (day < 10)
day = "0" + day;
if (month < 10) month = "0" + month;
dispTime = hours
+ ":" + minutes + ":" + seconds + " " + amOrPm;
dispDate = year + "年" + month
+ "月" + day+ "日, " ;
if (ns4up1)
{
document.layers.nowTime.document.write(dispTime);
document.layers.nowTime.document.close();
document.layers.nowDate.document.write(dispDate);
document.layers.nowDate.document.close();
}
else if (ns6up1){
document.getElementById("nowTime").innerHTML =
dispTime;
document.getElementById("nowDate").innerHTML = dispDate;
} else
if (ie4up1){
nowTime.innerHTML = dispTime;
nowDate.innerHTML =
dispDate;
} setTimeout("nowclock()", 1000);
}
nowclock();
//-->
</script>
<!--下面只是说明与程序代码无关-->
<div style="width:95%; height:auto;
display:block; margin:0 auto; margin-top:30px; font-size:10pt;
line-height:150%;">
<span>本代码由<a href="http://www.51xuediannao.com"
style="color:#F00;">懒人建站网 收集整理 我要学电脑.COM →51xuediannao.com</a>
</span><br>
<a href="http://www.51xuediannao.com">懒人建站 http://www.51xuediannao.com</a><br/>
<span>我们为您提供-
<a
href="http://www.51xuediannao.com/html+css/">HTML+CSS模板</a>,
<a
href="http://www.51xuediannao.com/js/">JS代码</a>,
<a
href="http://www.51xuediannao.com/JS/texiao/">网页特效</a>,
<a href="http://www.51xuediannao.com/JS/nav/">导航菜单</a>,
<a
href="http://www.51xuediannao.com/JS/Slide/">焦点幻灯片<a>,
<a
href="http://www.51xuediannao.com/JS/show/">网页欣赏</a>和
<a
href="http://www.51xuediannao.com/JS/jiqiao/css/">CSS技巧</a>;</span>
<span>懒人建站只收录实用和能提高用户体验的代码</span>
<span>我们只想解放出你的部分写代码时间来思考更高层次的设计,而不是要你懒惰、拼凑。</span>
</div>
</body>
</html>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。