Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Works in IE but not in Netscape.

    This link changes color on mouseover and mouseout works in IE but not in Netscape browser. I
    have the latest Netscape and IE browsers and my Javascript is enabled on both but why does the
    below not work in Netscape????


    <a
    href="myfile.htm" onMouseOver="javascriptverAndOut(this);window.status='MyText...';return
    true;"
    onMouseOut="javascriptverAndOut(this);window.status='';return true;"
    STYLE="font-size:8pt;">
    CHANGE LINK TEXT COLOR ON MOUSE OVER HERE</a>




    <script name="javascript">
    function overAndOut(oEl) {
    if (oEl.style.color == 'blue')
    oEl.style.color = 'orange';
    else oEl.style.color = 'blue';
    }
    </script>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is an example that will work in IE5+ and NS6+. It will not work in IE4 and NS4 version browsers, allthough it will not throw any errors. You just won't get the color change.
    Code:
    <html>
    <head>
    <title>Change Link Color</title>
       <SCRIPT LANGUAGE="JavaScript">
           function chgcolor(obj,lcolor)
              {
               if(document.getElementById)
                 {
                  whichone=obj.id
                  document.getElementById(whichone).style.color=lcolor
                 }
              }
       </SCRIPT>
    <CENTER>
    <H1>Link Effect Example</H1>
    Run your mouse over the links to see them change color
    </CENTER>
    <a href="http://www.wsabstract.com" style="color:blue" id="mylink" onMouseOver="chgcolor(this,'red')" onMouseOut="chgcolor(this,'blue')">Website Abstraction</a>
     </CENTER>
    </body>
    </html>

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For IE5+ NS6+ you would use CSS to accomplish the task
    This goes to css file or <STYLE> element
    Code:
    .myLink:link
      {color:                blue;
      }
    .myLink:visited
      {color:               blue;
          }
    .myLink:hover
      {color:                red;
      }
    Add class attribute to any anchor element.
    Code:
    <A HREF="..." CLASS="myLink">....</A>
    No JavaScript is needed. You can make your links change not only color but any other attribute you can specify in a style sheet.
    If you want to have some fun with your visitors..... try this:
    Code:
    .myLink:link
      { position:        static;
        color:              blue;
      }
    .myLink:visited
      {color:               blue;
          }
    .myLink:hover
      { position:	absolute;
        top:		100px;
        left:		200px;
        color:              red;
      }
    Last edited by Vladdy; 07-16-2002 at 04:50 PM.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Delaware, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I have Netscape 4.51

    Looks like I have Netscape 4.51 or 4.77.

    I can not use CSS so please advise if I can get this to work in my version of Netscape???

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Catch up with time and upgrade.... you are not building your website for yourself (are you?) but for the world (95% of which uses CSS compliant browsers)....
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Delaware, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The info in the link i provided seems to work for me. I tested it on NS 4.78

  • #8
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script not working on netscape

    I assume I need CSS to do this with Netscape 4.78 version. Unfortunately I can not use CSS due to style guide 508 restrictions here. Anyone have any other ideas on how to get this working on Netscape with my current browser???

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For Netscape 4 version browsers you can't use CSS to such as Vladdy's example to change the color of the link. What I have done in the past for NS4 is place the link within a div and rewrite the link when you mouse over and out. Not a very good way of doing it. I would suggest that you use Browser detection scheme's to detect which browser/version and if it is NS4 do nothing.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •