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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript drop-down menu link to html anchor

    Hi,

    I've created a drop-down menu in Fireworks and need to link the menu links to a web page that I have already inserted html achors into. The menu code (sample) looks like this:

    mm_menu_1112123030_0.addMenuItem("abcd","location='http://www.'");

    I have about 10 menu items that need to be linked to 10 anchors listed on the same page.

    Anyone have any ideas as to how this is achieved using js?

    Cheers,
    Adam
    Last edited by AMT; May 9th, 2005 at 03:46 PM.

  2. #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    on a ship
    Posts
    574
    Thanks
    1
    Thanked 6 Times in 5 Posts
    to go to an anchor ( <a> ) on the same page all you hve to do is for one, have anchors in the page and be sure to name them like so:
    <a id=#anchor1></a>Anchor One
    <a id=#anchor2></a>Anchor Two....ect

    dont put the anchor text within the anchor, it will show up as a link. this way it shows up only as text but the anchor is still there.

    and in the js all you have to do is assign the anchor id to window.location like so:
    window.location='#anchor1';

    it will jump to that anchor within the page.
    I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.

  3. #3
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fantastic, that seems to work nicely, thanks a lot 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
  •