HTML5网页设计

时间日期

显示时间日期网页代码

时间:2014-11-28 17:44来源:未知作者:点击:
!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 title设计酷-shejicool.com-兼容IE和FireFox的当前时间JS脚本/title /head body div

<!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>
    <title>设计酷-shejicool.com-兼容IE和FireFox的当前时间JS脚本</title>
    </head>
    <body>
    <div id="liveclock"></div>
    <script type="text/javascript">
function timeprint()
{
var week; var date;
var today=new Date()
var year=today.getFullYear()
var month=today.getMonth()+1
var day=today.getDate()
var ss=today.getDay()
var hours=today.getHours()
var minutes=today.getMinutes()
var seconds=today.getSeconds()
date=year+"年"+month+"月"+day+"日 "
if(ss==0) week="星期日"
if(ss==1) week="星期一"
if(ss==2) week="星期二"
if(ss==3) week="星期三"
if(ss==4) week="星期四"
if(ss==5) week="星期五"
if(ss==6) week="星期六"
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
myclock=date+week+" "+hours+":"+minutes+":"+seconds
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else
document.getElementById('liveclock').innerHTML=myclock
setTimeout("timeprint()",1000)
}
timeprint();
</script>
    </body>
    </html>
上一篇:上一篇:实用的网页显示当前时间日期代码 上一篇:下一篇:英文版当前日期显示
阅完本篇文章?您还可以: 收藏本文 文章挑错 朋友推荐