Results 1 to 4 of 4

Thread: need an option to "expand all" in folding tree menu

  1. #1
    Join Date
    Sep 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question need an option to "expand all" in folding tree menu

    Script: smart folding menu tree

    Hi! I'm working with this script above and the default is for the menu to be collapsed until clicked, the tree can persist and still be open when you come back to the page.

    I need to provide the user with one button that will expand all the lists as a way of browsing the categories without clicking 50 times. I haven't touched javascript in a couple of years and would really appreciate any help on this, i'm stumped.

    Thanks in advance!

  2. #2
    Join Date
    Dec 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Probably too late for the original poster, but for anybody reading this in the future, try this:

    function openallfolders(){
    if (ns6){
    for (i=0; i<=foldercontentarray.length; i++){
    foldercontentarray[i].style.display=''
    foldercontentarray[i].previousSibling.previousSibling.style.listStyleImage="url(open.gif)"
    }
    }
    else {
    for (i=0; i<foldinglist.length; i++){
    foldinglist[i].style.display=''
    document.all[foldinglist[i].sourceIndex -1].style.listStyleImage="url(open.gif)"
    }
    }
    }


    and the link should look like this:

    <a href="javascript:openallfolders()"> open all folders </a>


    and the "close all":

    function closeallfolders(){
    if (ns6){
    for (i=0; i<=foldercontentarray.length; i++){
    foldercontentarray[i].style.display='none'
    foldercontentarray[i].previousSibling.previousSibling.style.listStyleImage="url(fold.gif)"
    }
    }
    else {
    for (i=0; i<foldinglist.length; i++){
    foldinglist[i].style.display='none'
    document.all[foldinglist[i].sourceIndex -1].style.listStyleImage="url(fold.gif)"
    }
    }
    }

    with the link:

    <a href="javascript:closeallfolders()"> close all folders </a>


    Rog

  3. #3
    Join Date
    Feb 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Software Engineer

    Thank You, works beautifully.

  4. #4
    Join Date
    Feb 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi all,

    nice your reply @ dynamic drive about closeallfolders()

    Trying to change the script I did not find a good solution.

    At http://gammaholding.willemdezeeuw.nl you find the menu filled by a simple mdb. It's with dutch & english now.

    As you can see there, I hav 5 maingroups. I tryed to close the groups and only the active groep was unfolded. Other main group? Close the old open the new. With every thing opened there is not enough space.

    Do you have a clue?

    Thanks a lot,
    Willem de Zeeuw

    PS I'm new in this forum

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
  •