Дисплей на стойке регистрации страницы
Кода -копия выглядит следующим образом:
<span id = "clock" style = "font-size: 14px;"> </span>
JS Script
Кода -копия выглядит следующим образом:
$ (document) .ready (function () {
// первый тип
время для шоу();
// второй тип
var clock = new Clock ();
clock.display ($ ("#часы"));
});
// отображается первый метод обработки текущего времени системы
функция showtime () {
var myarray = new Array (7);
var td = new Date ();
myarray [0] = "воскресенье";
myarray [1] = "понедельник";
myarray [2] = "вторник";
myarray [3] = "Среда";
myarray [4] = "четверг";
myarray [5] = "пятница";
myarray [6] = "суббота";
Weekday = td.getday ();
var h = td.gethours ();
var m = td.getminutes ();
var s = td.getSeconds ();
var hstr = h;
var mstr = m;
var isr = s;
if (h <10) {hstr = "0" + h};
if (m <10) {mstr = "0" + m};
if (s <10) {isr = "0" + s};
$ ("#clock"). innerhtml ('Current Time:' + new Date (). TolocaledAtestring () + "" + myarray [Weekday] + "" + hstr + ":" + mstr + ":" + isr) ;
SetTimeout (Showtime, 1000);
}
// отображается второй метод обработки текущего времени системы
function clock () {
var date = new Date ();
this.year = date.getfyear ();
this.onth = date.getmonth ()+1;
this.date = date.getDate ();
this.day = newarray («воскресенье», «понедельник», «вторник», «среда», «четверг», «пятница», «суббота») [date.getday ()];
this.hour = date.gethours () <10? "0"+date.gethours (): date.gethours ();
this.minute = date.getMinutes () <10? "0"+date.getMinutes (): date.getMinutes ();
this.second = date.getSeconds () <10? "0"+date.getSeconds (): date.getSeconds ();
this.ToString = function () {
Верните «Текущее время:»+this.year+«Год»+this.month+«месяц»+this.date+"day"+this.hour+":"+this.minute+":"+this.second+"+ этот. День;
};
this.tosimpledate = function () {
returnthis.year+"-"+this.month+"-"+this.date;
};
this.todetaildate = function () {
returnthis.year+"-"+this.month+"-"+this.date+""+this.hour+":"+this.minute+":"+this.second;
};
this.display = function (ele) {
varClock = newClock ();
ele.innerhtml = clock.toString ();
window.settimeout (function () {clock.display (ele);}, 1000);
};
}