var clock = {
initYear:0,
initMonth:0,
initDay:0,
initHour:0,
initMinute:0,
initSec:0,
initTime:function (year,month,day,hour,minute,sec) {
this.initYear = year;
this.initMonth = month;
this.initDay = day;
this.initHour = hour;
this.initMinute = minute;
this.initSec = sec;
},
show:function () {
if(this.initSec>=59){
this.initSec=0;
this.initMinute++;
}
else{
this.initSec++;
}
if(this.initMinute>=59){
this.initMinute = 0;
this.initHour++;
}
if(this.initHour>=24){
this.initHour=0;
this.initDay ++;
}
var strL = "";
var strClock = ""+(this.initYear<10 ? '0'+this.initYear : this.initYear)+"年"+(this.initMonth<10 ? '0'+this.initMonth : this.initMonth)+"月";
strClock += ""+(this.initDay<10 ? '0'+this.initDay : this.initDay)+"日 "+(this.initHour<10 ? '0'+this.initHour : this.initHour)+":";
strClock += ""+(this.initMinute<10 ? '0'+this.initMinute : this.initMinute)+":"+(this.initSec<10 ? '0'+this.initSec : this.initSec)+"";
$("#clock").html(strClock);
}
};
$(document).ready(function () {
clock.initTime(2010,07,29,22,25,17);
setInterval("clock.show()",1000);
});