Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Text Rollover in Netscape and IE


  • From: javascript@xxxxxxxxxx (Steve Vernon)
  • Subject: [Javascript] Text Rollover in Netscape and IE
  • Date: Thu, 21 Nov 2002 21:48:59 -0000

Hiya,
    Most sources I can find do text rollover for a link, and I jsut wanna do
it for a span.

    My script is:

         <SCRIPT LANGUAGE="JavaScript">
   <!--
    var browser = "Null";

    if (document.all)
    {
     browser = "IE";
    }
    else if (document.layers)
    {
     browser = "OldNetscape";
    }
    else if (document.getElementById)
    {
       browser = "NewNetscape";
    }

    // alert(browser);

    function rollon()
    {
     if(browser == "Null") return;

     if(browser=="OldNetscape")
     {
      with (document["alterme"].document) {
            open ();
            write ("Friends");
            close ();}
     }
     else if(browser=="NewNetscape")
     {
      document.all("alterme").innerText = "<span>Friends</a>";
     }
     else
     {
      document.getElementById("alterme").innerText = "Friends";
     }


     }
    function rolloff()
    {
     if (!document.getElementById) return;
     var title = document.getElementById("alterme");
     title.style.color= '#000000';
     title.innerText = 'Friends';

     }

    // -->
  </SCRIPT>

    And what I want to alter is <span href="" class="title"
id="alterme">Click for friends</span>

    This works fine in IE but not in Netscape 7, also can someone give me a
clue please whether the old Netscape code works as well?

    Thanks!

    Steve