Results 1 to 3 of 3

Thread: AnyLink DD Menu tweak?

  1. #1
    Join Date
    Mar 2005
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default AnyLink DD Menu tweak?

    Hi,

    I'm using the AnyLink DD Menu http://www.dynamicdrive.com/dynamici...pmenuindex.htm and was wondering if it would be possible to set it up so that even though I'm using the script in an external .js file it does not show the current page in the the menu.

    That is to say if a user is on the "news" page, that link is removed from the drop down list.

    I can't think of anyway of doing it, and I'm starting to think it's not possible, but clarification would be nice either way!

    Thanks,
    Martyn.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There is probably a 'cleaner' way to do it but, this works:

    Put this script in the head of each page displaying the menu:
    Code:
    <script type="text/javascript">
    function hideItem(item){
    eval(item+'='+item+'.replace(/a href/,\'a style="display:none" href\')')
    }
    </script>
    You could probably just include its function at the beginning of your external script like so:
    Code:
    function hideItem(item){
    eval(item+'='+item+'.replace(/a href/,\'a style="display:none" href\')')
    }
    
    //Contents for menu 1
    var menu1=new Array()
    menu1[0]='<a href="http://www.javascriptkit.com">JavaScript Kit</a>'
    menu1[1]='<a href="http://www.freewarejava.com">Freewarejava.com</a>'
    Then on each page that this menu navigates to use this in the body tag:
    HTML Code:
    <body onload="hideItem('menu1[0]')">
    For menu1[0], just substitute the the menu#[#] you want excluded on that page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2005
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the info.

    My intranet has now gone live, so this will have to wait until I finish v2.0, as it will involve changing each and every page on the site (current count around 300!), and I really a) dont have the spare time and, b) cant be bothered right now!

    Still, it looks good, and it was basically what I had in my original version, before I placed the main script in an external.js file.

    Martyn.

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
  •