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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't jump to anchors in Mozilla/Firefox

    I'm trying to create a glossary for a site. I have a small function that creates a popup with two frames. The one along the top, glossary1, contains an alphabetic navigation bar. The bottom frame, glossary2, contains the glossary. I want to click on an href=javascript:glossary(term) and have the popup window go to the term.

    The code that I have works fine with IE, but I'm running into what I think is a bug in Firefox and Mozilla. When I click on one of the terms, the popup window will appear and navigate to the correct term. As soon as it finishes loading, it immediately returns to the top of the page.

    This is the code that I'm using:

    function glossary(term)
    {
    if (term) {
    first = term.charAt(0);
    first = first.toUpperCase();
    //url = "glossary" + first + ".html#" + term;
    url = "glossary" + first + ".html";
    mywindow = window.open(url, 'mywindow','etc');
    mywindow.glossary2.location.hash = term;
    mywindow.focus();
    }
    else {
    mywindow = window.open('glossaryA.html', 'mywindow', 'etc');
    mywindow.focus();
    }
    }

    Is this the correct way to jump to an anchor?

    Thanks for your help.

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Last edited by jamescover; 07-12-2004 at 02:15 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Doesn't this work?

    //url = "glossary" + first + ".html#" + term;
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes. Yes it does.

    (I can't believe I missed that.)

    Thanks for your help!


  •  

    Posting Permissions

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