Ashura: createTextNode

Beitrag lesen

Hallo Mssmar.

function errorMessage() {
   var TxtNode = document.createTextNode("Fehler Fehler Fehler");
   var ReplaceNode = Container.childNodes(0);
   ReplaceNode.replaceNode(TxtNode);
   Container.style.background ='#ff0000';
   Container.style.width ='200px';
}


>   
> ~~~html

<div id="Container"><p></p></div>  

> 

Dir ist bewusst, dass du hier zum Zugriff auf das div-Element http://de.selfhtml.org/javascript/objekte/all.htm@title=document.all verwendest?
Du solltest http://de.selfhtml.org/javascript/objekte/document.htm#get_element_by_id@title=getElementById nutzen, um dies zu bewerkstelligen.

Einen schönen Sonntag noch.

Gruß, Ashura

--
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
„It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
[HTML Design Constraints: Logical Markup]