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

Q849 Can I create a version of the mouse hover code that works on both Netscape Navigator 4 and Microsoft Internet Explorer 4?

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

Try the following:

<SCRIPT LANGUAGE="JavaScript"><!--
function high(what,text) {
    changeContent(what,'<DIV STYLE="color:red;">' + text + '<\/DIV>');
}

function low(what,text) {
    changeContent(what,text);
}

function changeContent(what,text) {
    if (document.layers) {
        what.document.open();
        what.document.write(text);
        what.document.close();
    }
}
//--></SCRIPT>

<P>
<DIV onMouseOver="this.style.color='red'"
  onMouseOut="this.style.color='black'">
<LAYER onMouseOver="high(this,'Move the mouse pointer over this text')"
  onMouseOut="low(this,'Move the mouse pointer over this text')">
Move the mouse pointer over this text
</LAYER>
</DIV>
</P>

©2018 Martin Webb