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

Q1669 How can I write into a Netscape Navigator 4 layer without specifying an absolutely positioned layer?

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

Try:

<script><!--
function changeIt(text) {
  if (document.layers) {
     document.layers['myILayer'].document.layers['myLayer'].document.open()
     document.layers['myILayer'].document.layers['myLayer'].document.write(text);
     document.layers['myILayer'].document.layers['myLayer'].document.close();
  }
  else if (document.getElementById)
    document.getElementById('myCell').innerHTML = text;
  else if (document.all)
    document.all.myCell.innerHTML = text;
}
//--></script>

<table>
  <tr>
    <td>This is the first sentence.</td>
    <td id="myCell">
      <ilayer id="myILayer">
        <layer id=myLayer style="position: relative;">
          Black Text
        </layer>
      </ilayer>
    </td>
    <td>This is the second sentence.</td>
  </tr>
</table>

<form>
<input value="Blue Text" type="button" onClick="changeIt('<font color=\'blue\'>Blue Text</font>')">
<input value="Red Text" type="button" onClick="changeIt('<font color=\'red\'>Red Text</font>')">
</form>

©2018 Martin Webb