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

Q149 How do I change selected parts of the HTML on the page?

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

Q149 How do I change selected parts of the HTML on the page?

The following will also work in Internet Explorer 4 and 5, and also in Netscape Navigator 6:

<script language="JavaScript"><--
function myClick2() {
  if (document.all) {
    document.all('MyID2').innerHTML = '<font color="#FF0000">This</font> is <b>not</b> <i>plain</i>';
  }
  else if (document.getElementById) {
    document.getElementById('MyID2').innerHTML = '<font color="#FF0000">This</font> is <b>not</b> <i>plain</i>';
  }
}
//--></script>

<p id="MyID2">This is a <b>plain</b> paragraph</p>

<form><input type="button" value="Click Me" onClick="myClick2()"></form>

Feedback on 'Q149 How do I change selected parts of the HTML on the page?'


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.