#!/COMMUNITY
Members: 5374
davon online: 1
weitere User: 32
12.02.2012 / 10:28
Community-Member werden
|
Paßwort vergessen
|
OnlineMonitor (1)
Perl-Archiv
Forum
Javascript
Home
PERLscripts
PHPscripts
JAVAscripts
Hilfreiches
Links2www
Newscenter
Community
Interna
Javascript
Archivübersicht
Tutorials
Zum Forum
JS-Links
BuchTipps
WebForen
Forenübersicht
Neueste Themen
Ohne Antwort
Aktivste Themen
Themensuche
Forenarchiv
Newsgroups
Javascript » Datum » Digitaluhr
zur Übersicht
Kategorie
Datum
Bezeichnung
Digitaluhr
ScriptDemo
Neues Fenster für Demo öffnen
Statistik
27146 Aufrufe davon 7x gestern
Diese Uhr läuft auf IE4, IE5, NS4 und NS6.
Javascript-Quellcode
(einfach markieren, kopieren und lokal abspeichern)
<SCRIPT> var loaded = false; if (document.layers) document.write( '<STYLE>.rewritable { position: absolute; }<\/STYLE>' ); function Clock (offsetSec, style) { this.id = Clock.cnt; Clock.clocks[Clock.cnt++] = this; this.offsetSec = offsetSec || 0; this.style = style || ''; this.writeHTML(); this.startTimer(); } function Clock_writeHTML () { var html = ''; if (document.layers) { html += '<SPAN'; html += ' ID="Clock' + this.id + '"'; html += ' CLASS="rewritable"'; html += '>'; html += '<SPAN'; html += this.style ? ' CLASS="' + this.style + '"' : ''; html += '>'; html += this.formatTime(); html += '<\/SPAN>'; html += '<\/SPAN>'; } else { html += '<SPAN'; html += ' ID="Clock' + this.id + '"'; html += this.style ? ' CLASS="' + this.style + '"' : ''; html += '>'; html += this.formatTime(); html += '<\/SPAN>'; } document.write(html); } Clock.prototype.writeHTML = Clock_writeHTML; function Clock_formatTime () { var time = new Date(); time.setTime(time.getTime() + this.offsetSec * 1000); var hours = time.getHours(); var minutes = time.getMinutes(); var seconds = time.getSeconds(); var html = ''; html += hours < 10 ? '0' + hours : hours; html += ':'; html += minutes < 10 ? '0' + minutes : minutes; html += ':'; html += seconds < 10 ? '0' + seconds : seconds; return html; } Clock.prototype.formatTime = Clock_formatTime; function Clock_startTimer () { this.tid = setInterval('Clock.clocks[' + this.id + '].updateTime()', 1000); } Clock.prototype.startTimer = Clock_startTimer; function Clock_updateTime () { if (document.all) document.all['Clock' + this.id].innerHTML = this.formatTime(); else if (document.getElementById) document.getElementById('Clock' + this.id).firstChild.nodeValue = this.formatTime(); else if (document.layers && loaded) { var l = document['Clock' + this.id]; if (!l.ol) { var ol = l.ol = new Layer(l.clip.width); ol.clip.height = l.clip.height; ol.left = l.pageX; ol.top = l.pageY; ol.visibility = 'show'; l.visibility = 'hide'; } var ol = l.ol; var html = ''; html += '<SPAN'; html += this.style ? ' CLASS="' + this.style + '"' : ''; html += '>'; html += this.formatTime(); html += '<\/SPAN>'; ol.document.open(); ol.document.write(html); ol.document.close(); } } Clock.prototype.updateTime = Clock_updateTime; Clock.cnt = 0; Clock.clocks = new Array(); function init () { loaded = true; } </SCRIPT> </HEAD> <BODY ONLOAD="init()"> Local time: <SCRIPT> new Clock(0, 'js'); </SCRIPT> <BR> GMT: <SCRIPT> var local = new Date(); var offset = local.getTimezoneOffset() * 60; new Clock(offset); </SCRIPT>
Kommentare zu
Digitaluhr
3 Kommentar(e) vorhanden / Anzeige der neuesten 5
am 30.06.2004 um 22:12 Uhr von Passo
funzt mit Opera 7.23 auf jeden fall. mit Netscape Navigator 7.10 Complete und IE 6.0 bei ...
am 10.12.2003 um 11:27 Uhr von neko
stimmt. wirklich funzt klasse....
am 30.08.2003 um 21:01 Uhr von Jonas
Sau geil! funzt der auch mit dem neuen Opera7 ?...
Alle Kommentare anzeigen
-
Kommentar hinzufügen
© PERL/CGI/
PHP
/JS/SCRIPT/unity.de 1998-2009 .::.
interaktiv.shop
.::.
CGI-Service
.::.
Kontakt
.::.
Impressum
Link: /javascript/scripts/javascript_0202_main.shtml .::. Aufrufe heute: 1 .::. Aufrufe gesamt: 20564