Hello,
I’m currently about to write a small JavaScript app that prints some text into an empty (already existing) div box.
The JavaScript file will be implemented as an external file called before the tag (to ensure that I can access the div box).
But the text to insert contains some HTML elements that must get properly handled.
When using the official way (at least the one I can imagine), e.g.
document.getElementById(“NewsHeadline”).childNodes[0].nodeValue=“Here is some important content to read.”
the HTML elements are printed “as is” and not processed.
However trying the dirty trick with innerHTML, e.g.
document.getElementById(“NewsHeadline”).innerHTML=“Here is some important content to read.”
anything is fine and “bold” text appears bold.
But I’m aware that innerHTML is not officially supported by the language standards.
Is innerHTML widely accepted across all browsers (JavaScript engines) or is there a more elegant solution on how to handle this ?
Any hint is appreciated
Bye,
Tobias.
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options