Juergens-Workshops.de Forum
komme nicht klar.... - Druckversion

+- Juergens-Workshops.de Forum (https://forum.juergens-workshops.de)
+-- Forum: HTML und Co (https://forum.juergens-workshops.de/forumdisplay.php?fid=62)
+--- Forum: CSS und Javascript (https://forum.juergens-workshops.de/forumdisplay.php?fid=86)
+--- Thema: komme nicht klar.... (/showthread.php?tid=25066)



komme nicht klar.... - jopeku - 11.02.2008

Hallo liebe Leute,

gebe ja zu Javascript ist "noch" nicht meine Stärke
Ich versuche die Logik zu begreifen aber irgendwo drehe
ich mich im Kreis.... kann mir jemand helfen?

Mein Problem:

Ich habe eine PHP Datei in der eine Tabelle Angezeigt werden soll sofern
eine bestimmte Bedingung erfüllt ist. In meinen Beispiel heißt die Bedingung
"Trigger". Das klappt auch.

Weiterhin befindet sich ein Script in der Seite, welches innerhalb der
Tabelle in 2 Zellen die ich per ID gekennzeichnet habe, die Werte erscheinen
die das Script erzeugt.

Auch das klappt einwandfrei.
Nur zusätzlich erscheinen die gleichen Werte oberhalb der Tabelle nochmals
und ich weiß nicht wo ich das abschalten kann.

Hier mal das Script:
[HTML]<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Bauen</title>
<base target="_self">
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #00FF66;
font-weight: bold;
}
-->
</style></head>

<body bgcolor="#510000">
<script type='text/javascript'>
<!--
var now = new Date();
var year = now.getYear();
if (year < 1900) {
year += 1900;
}
var NZeit = " 18:00:00 GMT";
var NMonat = "Februar 14, ";
var end = new Date(NMonat + year + NZeit);
document.write('<div style="text-align: center">');
document.write(' <span id="Bauname" style="FONT: bold 10px arial; COLOR: green"></span><br />');
document.write(' <span id="Bauzeit" style="font: bold 12px arial; color: green">;</span><br />');
document.write('</div>');

function toSt2(n) {
s = "";
if (n < 10) s += "0";
return (s + n).toString();
}
function toSt3(n) {
s = "";
if (n < 10) s += "00";
else if (n < 100) s += "0";
return (s + n).toString();
}
function countdown() {
d = new Date();
count = Math.floor(end.getTime() - d.getTime());
if(count > 0) {
miliseconds = toSt3(count%1000); count = Math.floor(count/1000);
seconds = toSt2(count%60); count = Math.floor(count/60);
minutes = toSt2(count%60); count = Math.floor(count/60);
hours = toSt2(count%24); count = Math.floor(count/24);
days = count;

document.getElementById('Bauzeit').innerHTML = hours + ':' + minutes + ':' + seconds + '';
document.getElementById('Bauname').innerHTML = "Restzeit";
setTimeout("countdown()", 50);
}
}
countdown();
//-->
</script>

<div align="center">
<?
$Trigger = 1;
if ( $Trigger ==1) {
echo "<table border=\"1\" width=\"90%\" id=\"table1\">";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td><div id=\"Bauname\">&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "<td><div id=\"Bauzeit\">&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "</table>";
}
?>
</div>

</body>

</html>[/HTML]
Danke falls mir jemand einen Weg aufzeigt Bussi


komme nicht klar.... - Helmut - 11.02.2008

Hi,

versuch es mal so...

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Bauen</title>
<base target="_self">
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #ffcc00;
font-weight: bold;
}
-->
</style>


<script type='text/javascript'>
<!--
var now = new Date();
var year = now.getYear();
if (year < 1900) {
year += 1900;
}
var NZeit = " 18:00:00 GMT";
var NMonat = "Februar 14, ";
var end = new Date(NMonat + year + NZeit);

function toSt2(n) {
s = "";
if (n < 10) s += "0";
return (s + n).toString();
}
function toSt3(n) {
s = "";
if (n < 10) s += "00";
else if (n < 100) s += "0";
return (s + n).toString();
}
function countdown() {
d = new Date();
count = Math.floor(end.getTime() - d.getTime());
if(count > 0) {
miliseconds = toSt3(count%1000); count = Math.floor(count/1000);
seconds = toSt2(count%60); count = Math.floor(count/60);
minutes = toSt2(count%60); count = Math.floor(count/60);
hours = toSt2(count%24); count = Math.floor(count/24);
days = count;

document.getElementById("Bauzeit").innerHTML = hours + ':' + minutes + ':' + seconds + '';
document.getElementById("Bauname").innerHTML = "Restzeit";
setTimeout("countdown()", 50);
}
}

//-->
</script>

</head>

<body bgcolor="#510000" onload="countdown()">


<table cellspacing="2" cellpadding="2" border="0">
<tr>
<td><div id="Bauname">&nbsp;</div></td>
<td><div id="Bauzeit">&nbsp;</div></td>
</tr>
</table>


</body>

</html>[/HTML]

deine Doppelausgabe kommt ja auch vom document.write...
Bitte auch Code blöcke mit dem entsprechenden BB-Code auszeichnen.

Cu Helmut


komme nicht klar.... - jopeku - 12.02.2008

danke für die rasche Antwort