Javascript nodeValue Implementaion: IE Versus Firefox / Opera

By Angsuman Chakraborty, Gaea News Network
Thursday, November 16, 2006

Internet Explorer (since 5.0) supports nodeValue() method to fetch the value of a node like Firefox or Opera, albeit with an exception. IE will provide the nodeValue only if the node is of type TextNode. So, for example, it will not give the nodeValue of a div. However Firefox and Opera works fine and provides the content. The solution is rather simple.

You can use innerHTML instead of nodeValue. It works on all the modern browsers.
Do you know of any caveats?

Discussion
August 16, 2008: 12:07 pm

I think that if you call a javascript: url from within flash and it does an operation on innerHTML, it can _sometimes_ cause location.href to change secretly to about:blank before the script is parsed - for an unknown reason. I’m having trouble reproducing it _consistently_ so I could be wrong. Works as I expect in Opera although that doesn’t rule out a bug in my code.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :