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

Q148 How do I change selected parts of the text on the page?

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

In Internet Explorer 4, the Dynamic Object Model allows you greater control over objects on the page. By identifying portions of the text using the ID attribute in a HTML tag you can directly access that portion of the text using in the innerText property of the required ID:

<SCRIPT LANGUAGE="JavaScript">
function myClick1() {
    document.all("MyID1").innerText = 'This is the changed paragraph.';
}
</SCRIPT>

<P ID="MyID1">This is a normal paragraph.</P>

<FORM><INPUT TYPE="BUTTON" VALUE="Click Me" onClick="myClick1()"></FORM>

©2018 Martin Webb