Seitenanlage Rezeption
Die Codekopie lautet wie folgt:
<span id = "clock" style = "Schriftgröße: 14px;"> </span>
JS -Skript
Die Codekopie lautet wie folgt:
$ (Dokument) .Ready (function () {
// der erste Typ
Show Time();
// der zweite Typ
var clock = new Clock ();
Clock.Display ($ ("#clock"));
});
// Die erste Verarbeitung der aktuellen Zeit des Systems wird angezeigt
FunktionshowTime () {
var myarray = new Array (7);
var td = new Date ();
myarray [0] = "sunday";
myarray [1] = "montag";
MyArray [2] = "Dienstag";
myarray [3] = "Mittwoch";
myarray [4] = "Donnerstag";
myarray [5] = "Freitag";
myarray [6] = "Samstag";
Wochentag = 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 ('Aktuelle Zeit:' + neues Datum (). TolocalEdateString () + "" + Myarray [Wochentag] + " + HSTR +": " + mstr +": " + isr) ;
setTimeout (Showtime, 1000);
}
// Die zweite Verarbeitung der aktuellen Zeit des Systems wird angezeigt
Funktion Clock () {
var date = new Date ();
this.year = date.getingfoyear ();
this.onth = date.getMonth ()+1;
this.date = date.getDate ();
this.day = newArray ("sunday", "montag", "toiday", "wednesday", "Donnerstag", "Friday", "Samstag") [Datum.Getay ()];
this.Hour = Datum.Gethours () <10? "0"+Datum.Gethours (): Datum.Gethours ();
this.minute = date.getminutes () <10? "0"+date.getminutes (): Date.getminutes ();
this.second = date.getSeconds () <10? "0"+date.getSeconds (): Date.getSeconds ();
this.toString = function () {
Rückgabe "Die aktuelle Zeit ist:"+this.year+"Jahr"+this.month+"monat"+thate.date+"tag"+thur.bour+":"+this.minute+":"+this.second+""+"+"+"+"+"+"+"+"+"+"+"+"+"+ dieser. Tag;
};
this.tosimpledate = function () {
return this.year+"-"+this.month+"-"+this.date;
};
this.todetailDate = function () {
return this.year+"-"+this.month+"-"+thate.date+""+this.Hour+":"+this.minute+":"+this.second;
};
this.display = function (ele) {
varclock = newClock ();
ele.innerhtml = clock.toString ();
window.settimeout (function () {clock.display (ele);}, 1000);
};
}