Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1370 What are innerText, outerText, innerHTML and outerHTML?

irt.org | Knowledge Base | DHTML | Q1370 [ previous next ]

Q1370 What are innerText, outerText, innerHTML and outerHTML?

They are one way of accessing the inner and outer text or HTML associated with a tag in Internet Explorer 4+. Using an id attribute, you can access any content of the page in Internet Explorer 4+ using these attributes.

Take the following code as an example:

<p id="myid">Here is some <b>interesting</b> text</p>

Then:

<script language="JavaScript"><!--
alert(document.all['myid'].innerText); // shows 'Here is some interesting text'
alert(document.all['myid'].outerText); // shows 'Here is some interesting text'
alert(document.all['myid'].innerHTML); // shows 'Here is some <b>interesting</b> text'
alert(document.all['myid'].outerHTML); // shows '<p id="myid">Here is some <b>interesting</b> text</p>'
//--></script>

Feedback on 'Q1370 What are innerText, outerText, innerHTML and outerHTML?'

What's New

How to do the impossible with Google Gears

Out and About


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.