More DOM differences

My incursion into the land of DOM scripting hit upon another difference between IE and Firefox, another simple example…

<Div id="test">
Hello there
</Div>

The task, use JavaScript to change the text in the Div, easy eh?

document.getElementById("test").firstChild.value = "new text"
or
document.getElementById("test").innerText = "new text"

Well, turns out I used both! IE seems to like the 2nd and Firefox the 1st, with neither complaining about the other. Now I can see why the AJAX libraries have their DOM abstraction functions!

Advertisements
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s