js 时间

<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">
window.onload=function(){

setInterval(a

,1000);
a();

function a(){
var body=document.body;

var myTime = new Date();

var iYear = myTime.getFullYear();
var iMonth = myTime.getMonth()+1;
var iDate = myTime.getDate();
var iWeek = myTime.getDay();if(iWeek==0){

iWeek="星期天";if( iWeek === 0 ) iWeek = '星期日';
if( iWeek === 1 ) iWeek = '星期一';
if( iWeek === 2 ) iWeek = '星期二';
if( iWeek === 3 ) iWeek = '星期三';
if( iWeek === 4 ) iWeek = '星期四';
if( iWeek === 5 ) iWeek = '星期五';
if( iWeek === 6 ) iWeek = '星期六';

}
var iHours = myTime.getHours();
var iMin = myTime.getMinutes();
var iSec = myTime.getSeconds();
var str=iYear+ '年' +iMonth+'月'+iDate+'日 '+ b(iWeek)+' '+ b(iHours)+' : '+ b(iMin)+' : '+ b(iSec);
body.innerHTML=str;

}
function b(n){

if(n<10){

return "0"+n;

}
else{
return ""+ n;
}

}

上一篇:nagios 安装配置(包含nrpe端)全 (三)


下一篇:微软发布VSBT,无需安装Visual Studio即可实现项目编译