.nils.: rekursive funktion

Beitrag lesen

Hallo,

  
<?xml version="1.0" encoding="utf-8" ?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de" dir="ltr">  
  
<head>  
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />  
   <meta http-equiv="Content-Script-Type" content="text/javascript" />  
   <meta http-equiv="content-language" content="de" />  
   <title>Test Rekursion</title>  
</head>  
  
<body>  
 <p id="countdown">10... </p>  
   <script type="text/javascript">  

~~~~~~javascript
  
/* <![CDATA[ */  
x=9;  
rek(x);  
function rek(x) {  
   meinText=document.createTextNode(x+"... ");  
   document.getElementById("countdown").firstChild.appendData(meinText.nodeValue);  
   if(x > 0) window.setTimeout("rek("+(x-1)+")",20);  
}  
/* ]]> */  

~~~~~~html
  
   </script>  
</body>  
  
</html>  

ist Standardkonform, funktioniert bei mir im Firefox. Für andere Browser keine Garantie :-)

Gruß, Nils

p.s. Weiß jemand, wieso die Javascript-Konsole im Firefox meckert, wenn ich das script auslagere????? Fehlermeldung: "document.getElementById("hallo") has no properties (...)"