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

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

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

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

©2018 Martin Webb