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

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

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

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

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>

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.