Announcement

Collapse
No announcement yet.

Adding sections to the drop down list

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Adding sections to the drop down list

    The standard Actinic 'search by section' feature uses just the top level sections in it's list
    The AUG shows that you can include the top 3 section levels by using the following Javascript instead (pasted in at end of message)

    I only want the top TWO sections however - do any of you Javascripters out there know how to reduce this so that only 2 levels show rather than 3?

    Cheers

    Jos


    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    /***********************************************************************
    *
    * ACT_DropListBox - returns a string containing the HTML for the SELECT listbox
    *
    ************************************************************************/

    function ACT_DropListBox(ar)
    {
    var strIDs = '<SELECT SIZE="1" NAME="ACT_droplstbox" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">';
    var sel = " SELECTED"
    strIDs += '<OPTION ' + sel + ' VALUE="">Select a Section</OPTION>';
    for (var i=1;i<=ar.length;i++)
    {
    if (ar[i].sURL !=null)
    {
    strIDs += '<OPTION VALUE="' + ar[i].sURL + '&ACTINIC_REFERRER=' + escape(location.href) + '">' + ar[i].sName + '</OPTION>';
    {
    if (ar[i].pChild)
    {
    for (var j=1;j<=ar[i].pChild.length;j++)
    {
    strIDs += '<OPTION VALUE="' + ar[i].pChild[j].sURL + '&ACTINIC_REFERRER=' + escape(location.href) + '">' + '- ' + ar[i].pChild[j].sName + '</OPTION>';
    {
    if (ar[i].pChild[j].pChild)
    {
    for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
    {
    strIDs += '<OPTION VALUE="' + ar[i].pChild[j].pChild[k].sURL + '&ACTINIC_REFERRER=' + escape(location.href) + '">' + '- - ' + ar[i].pChild[j].pChild[k].sName + '</OPTION>';
    }
    }
    }
    }
    }
    }
    }
    }
    strIDs+='</SELECT>'
    return strIDs
    }
    //-->
    </SCRIPT>
    Thanks

    Jos Medinger

    Tel : 01978 843 962
    www.internetology.co.uk
    Actinic / E-Commerce Hosting, Design & SEO
    ______________________________________

    #2
    Just remove the following:

    {
    if (ar[i].pChild[j].pChild)
    {
    for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
    {
    strIDs += '<OPTION VALUE="' + ar[i].pChild[j].pChild[k].sURL + '&ACTINIC_REFERRER=' + escape(location.href) + '">' + '- - ' + ar[i].pChild[j].pChild[k].sName + '</OPTION>';
    }
    }
    }


    Be careful to get the correct number of opening and closing {} curly brackets - they must pair up.
    Chris Brown

    Comment

    Working...
    X