Hallo ,
was würdet Ihr anders machen ?
es Funktioniert zwar..
aber ich denke man könnte es anders einfacher machen.. !
es soll nur den Unix Time Stamp von 01.12.2017 bis 24.12.2017
0:00 Uhr
leicht verzögert ausgeben
im Beispiel nur bis 06.12
es ist nur eine Übung für mich..
aber nutze die Zahlen auch für einen Adventskkalender
den ich schon fertig habe u. auch läuft
Danke fürs Ansehen des Codes u. evtl. Antworten von Euch
Gruß aus Hamburg - modem-kind
Code
[TABLE]
[TR]
[TD='class: line-content'] <body>[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] <button onclick="start1()">Einzeln</button>[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] <button onclick="start2()">Mehrfach</button>[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] <h1> <div id="ausgabe" style="text-align: center; color: red;"></div></h1>
[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][B][COLOR=#0000ff] <script>[/COLOR][/B][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] zahl = 0;[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content']// for (i = 0; i < 5; i++) {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] function start1() {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content']// function() {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] var d = new Date(2017, 11, 1, 0, 0, 0); //2016, 11, 8, 23, 59, 59[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] // alert(d);[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] time = d.getTime();[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] // alert(time); [/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] zahlplus = zahl++;[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content']// alert(zahlplus);[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] add = time + 86400000 * zahlplus;[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] // alert(add + " ergebnis"); [/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] document.getElementById("ausgabe").innerHTML += add + "<br>" + "<br>";[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] }[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] [/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] i = 0;[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] function start2() {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content']// setTimeout(function () {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] start1();[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content']// }, 2000);[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] c = ++i;[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] if (c === 6) {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] // alert(c);[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] return;[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] }[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] setTimeout(function () {[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] start2();[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] }, 0800);[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] }[/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][B][COLOR=#0000ff] </script>[/COLOR][/B][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'][/TD]
[/TR]
[TR]
[TD='class: line-number'][/TD]
[TD='class: line-content'] </body>[/TD]
[/TR]
[/TABLE]
Alles anzeigen