innerText - Wie kann ich das für Netscape implementieren?
Benjamin Stauß
- javascript
Hallo,
ich habe folgenden Javascript-Code:
<script language="JavaScript">
<!--
var countDownInterval=46
var countDownTime=countDownInterval;
function countDown()
{
--countDownTime;
if (countDownTime < 0)
{
countDownTime=countDownInterval;
}
document.getElementById('countDownText').innerText = countDownTime;
setTimeout("countDown()", 1000);
if (countDownTime == 0)
{
<?
echo "window.location="success_top.php?mailid=$_GET[mailid]&username=$_GET[username]";;";
?>
}
}
// -->
</script>
Countdown erfolgt in <b id="countDownText"></b> Sekunden.
<script language="JavaScript">
<!--
setTimeout("countDown()", 1000);
// -->
</script>
Dieser Code funktionier beim IE auch problemlos. Allerdings funktioniert dass innerText Attribut nicht bei Netscape. Wer kann mir eine mögliche Implementierung dieses Countdowns sagen, der für alle Browser funktioniert.
Vielen Dank schonmal und viele Grüße
Beni
Hallo,
Dieser Code funktionier beim IE auch problemlos. Allerdings funktioniert dass innerText Attribut nicht bei Netscape.
Welcher Netscape?
Wer kann mir eine mögliche Implementierung dieses Countdowns sagen, der für alle Browser funktioniert.
Niemand.
Für alle Browser, die DOM vollständig (node http://selfhtml.teamone.de/javascript/objekte/node.htm) implementiert haben, geht das:
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
var i = 10;
function countdown() {
var elinh = document.createTextNode(i);
document.getElementById("z").replaceChild(elinh, document.getElementById("z").firstChild);
i--;
if (i>=0) window.setTimeout("countdown()",1000);
}
//-->
</script>
<noscript></noscript>
</head>
<body onload="countdown();">
<p id="z"> </p>
</body>
</html>
viele Grüße
Axel