one man army wrote:
<URL:http://developer.mozilla.org/en/docs/DOM:element.textContent>
I tried setting the textContent on a trivial DIV text element.
Querying the result with window.alert() shows that it worked. Yet the
page does not change.
Which browser have you tried with? Only newer Mozilla versions and I
think Opera 9 preview support element.textContent as that is a DOM Level
3 Core property and so far support for DOM Level 3 Core has not been a
major goal for browser DOM implementors.
With pure DOM Level 2 (or 1 too) you can always do
function setTextContent (element, text) {
while (element.hasChildNodes()) {
element.removeChild(element.lastChild);
}
var doc = element.ownerDocument || document;
element.appendChild(doc.createTextNode(text));
}
setTextContent(someElementObject, 'Kibology for all.');
Some browsers like IE or Opera also implement a property named innerText
in the HTML DOM which is very much the same as textContent.
--
Martin Honnen
http://JavaScript.FAQTs.com/