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