SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Mouseover help

    Hi. I am using an external .js file to control the mouseovers on the page. And before anyone says anything, I think yes, I did borrow it from Sitepoint!

    Anyway, this is the code for the .js file:

    PHP Code:


    //makes sidebar titles popup
    function onLoad()
        {
         
    browserName navigator.appName;
         
    browserVer parseInt(navigator.appVersion);

         
    userAgent navigator.userAgent;
           
    start userAgent.indexOf("(");
           
    end userAgent.indexOf(";");
           
    platformuserAgent.substring(start +1,end);

            if (
    browserName == "Netscape" && browserVer >= 3version "n3";
            else 
    version "n2";
            if (
    browserName == "Microsoft Internet Explorer" && browserVer >= 4version "n3";

            if ((
    version == "n3"))
            {
                
    toc1on = new Image();
                
    toc1on.src ="images/buttons/company_button_intruder_on.gif";
                
    toc2on = new Image();
                
    toc2on.src ="images/buttons/company_button_fire_on.gif";
                
    toc3on = new Image();
                
    toc3on.src ="images/buttons/company_button_locks_on.gif";
                
    toc4on = new Image();
                
    toc4on.src ="images/buttons/company_button_resource_on.gif";
            
    tocpon = new Image();
                
    tocpon.src ="images/buttons/company_button_profile_on.gif";
                
    tocmon = new Image();
                
    tocmon.src ="images/buttons/company_button_mission_on.gif";
                
    toccon = new Image();
                
    toccon.src ="images/buttons/company_button_contact_on.gif";            

                
    toc1off = new Image();
                
    toc1off.src "images/buttons/company_button_intruder_off.gif";
                
    toc2off = new Image();
                
    toc2off.src "images/buttons/company_button_fire_off.gif";
                
    toc3off = new Image();
                
    toc3off.src ="images/buttons/company_button_locks_off.gif";
                
    toc4off = new Image();
                
    toc4off.src ="images/buttons/company_button_resource_off.gif";
            
    tocpoff = new Image();
                
    tocpoff.src "images/buttons/company_button_profile_off.gif";
                
    tocmoff = new Image();
                
    tocmoff.src "images/buttons/company_button_mission_off.gif";
                
    toccoff = new Image();
                
    toccoff.src ="images/buttons/company_button_contact_off.gif";
            }

        }


    onLoad();



    function 
    img_act(imgName) {

            if ((
    version == "n3" ||  version == "n4"  )) {

            
    imgOn = eval(imgName "on.src");
            
    document [imgName].src imgOn;

            }

           else
        return;

    }

    function 
    img_inact(imgName) {
            if ((
    version == "n3"  ||  version == "n4" )) {
            
    imgOff = eval(imgName "off.src");
            
    document [imgName].src imgOff;

            }
           else

        return;


    and then using this to call it:

    PHP Code:
    <a href="mission_statement.html" TARGET="bodytext" onMouseOver="img_act('tocm'); return true" onMouseOut="img_inact('tocm')  ; return true"><IMG SRC="images/buttons/company_button_mission_off.gif" ALT="AGS Mission Statement" border="0" name="tocm"></A
    Anyway. I would like to know if there is anyway to modify this code, so that when one of the buttons is actually clicked (rather than mouseover'd), the on state remains, until another button is clicked.

    The problem is that these buttons are in one frame, which is then changing the contents of another frame. Then selecting an option from that frame changes the contents of the main frame.

    Any help is much appreciated!
    Last edited by weirdbeardmt; Jul 27, 2001 at 09:47.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use onClick() to set a variable which onMouseOut() would check for.


Bookmarks

Posting Permissions

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