YourWBB


yourWBB » yourWBB Misc * » Das Proggen » HTML, XHTML, JavaScript & CSS » Liveticker » Hallo Gast [Anmelden|Registrieren]
Letzter Beitrag | Erster ungelesener Beitrag 2.041 Views | | Thema zu Favoriten hinzufügen

Neues Thema erstellen Antwort erstellen

Zum Ende der Seite springen Liveticker
Autor
Beitrag « Vorheriges Thema | Nächstes Thema »
d0g1am.
Mitglied


Dabei seit: 15.11.08
Beiträge: 37

 Liveticker Antworten Zitieren Editieren Melden       UP

Hallo Leute,
ihr kennt ja bestimmt das JavaScript für den Countdown, wo dann die Zeit bis zu einem bestimmten Zeitpunkt runtergezählt wird.
Ich brauche jetzt für einen kleinen Liveticker das ganze genau anders herum großes Grinsen
Heißt im Klartext:
Ich gebe eine Startuhrzeit an (z.B. 15:30 Uhr). Von diesem Zeitpunkt an sollen die vergangenen Minuten in der Form "Minuten:Sekunden" angezeigt werden.
Das ganze sollte dann bei 45:00 Minuten einfach stoppen (ohne Alert oder sonstwas).
Danach das ganze dann nochmal von einer Uhrzeit von 45:00 bis 90:00 smile

Wäre cool, wenn da einer was für mich hat smile

Gruß

EDIT: Gefunden habe ich bis jetzt das:

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">

<head>
    <title>Liveticker</title>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <meta name="keywords" content="" />
    <meta name="generator" content="Webocton - Scriptly (www.scriptly.de)" />

    <link href="style.css" type="text/css" rel="stylesheet" />

    <style style="text/css">

.dcountstyle{ /*Example CSS to style count up output*/
font: bold 16px Arial;
padding: 3px;
}

.dcountstyle sup{ /*Example CSS to style count up output*/
font-size: 90%
}

</style>

<script type="text/javascript">

/***********************************************
* Dynamic CountUp script- © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function dcountup(startingdate, baseunit){
	this.currentTime=new Date()
	this.startingdate=new Date(startingdate)
	this.timesup=false
	this.baseunit=baseunit
	this.start()
}

dcountup.prototype.oncountup=function(){} //default action for "oncountup"

dcountup.prototype.start=function(){
	var thisobj=this
	this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
	var timediff=(this.currentTime-this.startingdate)/1000 //difference btw target date and current date, in seconds
	var oneMinute=60 //minute unit in seconds
	var oneHour=60*60 //hour unit in seconds
	var oneDay=60*60*24 //day unit in seconds
	var dayfield=Math.floor(timediff/oneDay)
	var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
	var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
	var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
	if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
		hourfield=dayfield*24+hourfield
		dayfield="n/a"
	}
	else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
		minutefield=dayfield*24*60+hourfield*60+minutefield
		dayfield=hourfield="n/a"
	}
	else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
		var secondfield=timediff
		dayfield=hourfield=minutefield="n/a"
	}
	var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}
	this.oncountup(result)
	setTimeout(function(){thisobj.start()}, 1000) //update results every second
}

</script>


</head>

<body>

<div id="cpcontainer">&nbsp;</div>

<script type="text/javascript">

//SYNTAX: myvariable=new dcountup(past_date_and_time_string, "baseunit")
var princewedding=new dcountup("August 16, 2009 21:04:00", "minutes")

princewedding.oncountup=function(result){
	//result is an object containing the current count up date/time, updated every second
	//Available properties: result["days"], result["hours"], result["minutes"], and result["seconds"]
	var mycountainer=document.getElementById("cpcontainer")
	mycountainer.innerHTML="    1. Halbzeit <br /> "+result['minutes']+" <sup>minutes</sup> "+result['seconds']+" <sup>seconds</sup></span>"
}

</script>



</body>
</html>


Und das soll jetzt beii 45:00, bzw. bei 90:00 stoppen smile

Dieser Beitrag wurde 2 mal editiert, zum letzten Mal von d0g1am.: 16.08.09 21:07.

16.08.09 20:38 d0g1am. ist offline E-Mail Finden Als Freund hinzufügen
Baumstruktur | Brettstruktur
Gehe zu:

Neues Thema erstellen Antwort erstellen

yourWBB » yourWBB Misc * » Das Proggen » HTML, XHTML, JavaScript & CSS » Liveticker