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

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

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

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.