You are here: irt.org | FAQ | DHTML | Q779 [ previous next ]
Netscape Navigator 4.0 does not have a comparable innerHTML property. This does not mean that Netscape Navigator cannot write dynamic content like Microsoft Internet Explorer, as you can open, write to, and then close a layer. The difficulty is that you have to write a solution that works perfectly on both Netscape Navigator and Microsoft Internet Explorer.
The following is a simple example that works in both Netscape Navigator 4 and Microsoft Internet Explorer 4:
<P> <script language="JavaScript"><!-- function changeContent(what,text) { if (document.all) what.innerHTML = text; else if (document.layers) { what.document.open(); what.document.write(text); what.document.close(); } } //--></script> <p> <div onMouseOver="changeContent(this,'<font color=red>Ha! You moved the mouse over the text</font>')" onMouseOut="changeContent(this,'Move the mouse pointer over this text')"> <layer onMouseOver="changeContent(this,'<font color=red>Ha! You moved the mouse over the text</font>')" onMouseOut="changeContent(this,'Move the mouse pointer over this text')"> Move the mouse pointer over this text </layer> </div> </p>
Also take a look at the article What is So Dynamic About Dynamic HTML?