Hardy
27.05.2010, 16:22
Ich stehe mal wieder auf den Schlauch und bekomme hier wieder was nicht hin :rolleyes:
Ich hätte gerne eine Countdown dafür habe ich folgenden JAVACode verwendet:
<?while($blabla = mysql_fetch_array($blablabla)){
$i++;
unset($new_endcountdown);
$new_endcountdown = ($blabla['endzeit'] - time());
;?><script language='javascript'>
function doCount_<?=$i;?>()
{
var countdown_<?=$i;?> = <?=$new_endcountdown;?>;
var returnvar = '';
if (countdown_<?=$i;?> > 0) {
countdown_<?=$i;?>--
var s = countdown_<?=$i;?>;
var d = Math.floor(s/(24*3600));
var h = Math.floor((s - (d * 24*3600))/3600);
var m = Math.floor((s - (d * 24*3600) - (h * 3600))/60);
var sek = Math.floor(s - (d * 24*3600) - (h * 3600) - (m * 60));
if(d != 0) {
returnvar = returnvar+d+'d ';
}
if(h != 0) {
returnvar = returnvar+h+'h ';
}
if(m != 0) {
returnvar = returnvar+m+'min ';
}
if(sek != 0) {
returnvar = returnvar+sek+'s ';
}
}
else {
returnvar = 'Fertig';
}
document.getElementById('countdown_<?=$i;?>').innerHTML = returnvar;
window.setTimeout('doCount_<?=$i;?>()',1000)
}
</script>
<div id='countdown_<?=$i;?>'></div><?}?>im Quelltext sieht das ganze dann so aus:
<script language='javascript'>
function doCount_1()
{
var countdown_1 = 234;
var returnvar = '';
if (countdown_1 > 0) {
countdown_1--
var s = countdown_1;
var d = Math.floor(s/(24*3600));
var h = Math.floor((s - (d * 24*3600))/3600);
var m = Math.floor((s - (d * 24*3600) - (h * 3600))/60);
var sek = Math.floor(s - (d * 24*3600) - (h * 3600) - (m * 60));
if(d != 0) {
returnvar = returnvar+d+'d ';
}
if(h != 0) {
returnvar = returnvar+h+'h ';
}
if(m != 0) {
returnvar = returnvar+m+'min ';
}
if(sek != 0) {
returnvar = returnvar+sek+'s ';
}
}
else {
returnvar = 'Fertig';
}
document.getElementById('countdown_1').innerHTML = returnvar;
window.setTimeout('doCount_1()',1000)
}
</script>
<div id='countdown_1'></div>
<script language='javascript'>
function doCount_2()
{
var countdown_2 = 66;
var returnvar = '';
if (countdown_2 > 0) {
countdown_2--
var s = countdown_2;
var d = Math.floor(s/(24*3600));
var h = Math.floor((s - (d * 24*3600))/3600);
var m = Math.floor((s - (d * 24*3600) - (h * 3600))/60);
var sek = Math.floor(s - (d * 24*3600) - (h * 3600) - (m * 60));
if(d != 0) {
returnvar = returnvar+d+'d ';
}
if(h != 0) {
returnvar = returnvar+h+'h ';
}
if(m != 0) {
returnvar = returnvar+m+'min ';
}
if(sek != 0) {
returnvar = returnvar+sek+'s ';
}
}
else {
returnvar = 'Fertig';
}
document.getElementById('countdown_2').innerHTML = returnvar;
window.setTimeout('doCount_2()',1000)
}
</script>
<div id='countdown_2'></div>
...usw.
Leider zeigt er mir keinen Countdown an...einer ne Idee woran es liegen kann?
Ich hätte gerne eine Countdown dafür habe ich folgenden JAVACode verwendet:
<?while($blabla = mysql_fetch_array($blablabla)){
$i++;
unset($new_endcountdown);
$new_endcountdown = ($blabla['endzeit'] - time());
;?><script language='javascript'>
function doCount_<?=$i;?>()
{
var countdown_<?=$i;?> = <?=$new_endcountdown;?>;
var returnvar = '';
if (countdown_<?=$i;?> > 0) {
countdown_<?=$i;?>--
var s = countdown_<?=$i;?>;
var d = Math.floor(s/(24*3600));
var h = Math.floor((s - (d * 24*3600))/3600);
var m = Math.floor((s - (d * 24*3600) - (h * 3600))/60);
var sek = Math.floor(s - (d * 24*3600) - (h * 3600) - (m * 60));
if(d != 0) {
returnvar = returnvar+d+'d ';
}
if(h != 0) {
returnvar = returnvar+h+'h ';
}
if(m != 0) {
returnvar = returnvar+m+'min ';
}
if(sek != 0) {
returnvar = returnvar+sek+'s ';
}
}
else {
returnvar = 'Fertig';
}
document.getElementById('countdown_<?=$i;?>').innerHTML = returnvar;
window.setTimeout('doCount_<?=$i;?>()',1000)
}
</script>
<div id='countdown_<?=$i;?>'></div><?}?>im Quelltext sieht das ganze dann so aus:
<script language='javascript'>
function doCount_1()
{
var countdown_1 = 234;
var returnvar = '';
if (countdown_1 > 0) {
countdown_1--
var s = countdown_1;
var d = Math.floor(s/(24*3600));
var h = Math.floor((s - (d * 24*3600))/3600);
var m = Math.floor((s - (d * 24*3600) - (h * 3600))/60);
var sek = Math.floor(s - (d * 24*3600) - (h * 3600) - (m * 60));
if(d != 0) {
returnvar = returnvar+d+'d ';
}
if(h != 0) {
returnvar = returnvar+h+'h ';
}
if(m != 0) {
returnvar = returnvar+m+'min ';
}
if(sek != 0) {
returnvar = returnvar+sek+'s ';
}
}
else {
returnvar = 'Fertig';
}
document.getElementById('countdown_1').innerHTML = returnvar;
window.setTimeout('doCount_1()',1000)
}
</script>
<div id='countdown_1'></div>
<script language='javascript'>
function doCount_2()
{
var countdown_2 = 66;
var returnvar = '';
if (countdown_2 > 0) {
countdown_2--
var s = countdown_2;
var d = Math.floor(s/(24*3600));
var h = Math.floor((s - (d * 24*3600))/3600);
var m = Math.floor((s - (d * 24*3600) - (h * 3600))/60);
var sek = Math.floor(s - (d * 24*3600) - (h * 3600) - (m * 60));
if(d != 0) {
returnvar = returnvar+d+'d ';
}
if(h != 0) {
returnvar = returnvar+h+'h ';
}
if(m != 0) {
returnvar = returnvar+m+'min ';
}
if(sek != 0) {
returnvar = returnvar+sek+'s ';
}
}
else {
returnvar = 'Fertig';
}
document.getElementById('countdown_2').innerHTML = returnvar;
window.setTimeout('doCount_2()',1000)
}
</script>
<div id='countdown_2'></div>
...usw.
Leider zeigt er mir keinen Countdown an...einer ne Idee woran es liegen kann?