Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt

Q1370 What are innerText, outerText, innerHTML and outerHTML?

You are here: irt.org | FAQ | DHTML | Q1370 [ previous next ]

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?'

©2013 Martin Webb