DHTML

by David.Artiss(at)boots.co.uk

 Date:  Fri, 24 Sep 1999 12:20:29 +0000
 To:  hwg-basics(at)hwg.org
  todo: View Thread, Original
I'm just coming to grips with DHTML but Netscape is still giving me grief !

I've written a simple (I think) script to change the colour of a menu
option when the mouse moves over it. I've written it so that it detects
whether the browser is IE or Netscape and then does it's own seperate
thing. Except I'm stuck on what to do with Netscape. I have two books on
the subject but they're not helping. Any ideas or does anybody have a
neater way of achieving it ?

<script language="JavaScript">
function ChangeColor(option,changeto) {
     var myBrowser = navigator.userAgent
     if(myBrowser.lastIndexOf("MSIE") != -1)
     {theStyle = document.all[option].style;
     theStyle.color = changeto;}
     else
     {
     }
}
</script>

<a href="menu.htm" id="option1" style="color: green; text-decoration:
none;"
onMouseOver = "ChangeColor('option1','lightgreen')"
onMouseOut = "ChangeColor('option1','green')">News</A>

Thanks,
David Artiss.

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA