WordPress.org

Ready to get started?Download WordPress

Forums

Drop down menu script with links (3 posts)

  1. Wish Web Geek
    Member
    Posted 1 year ago #

    I do not know javascript and am trying to create a drop down menu. Here is the script I pulled from another website. But the value="url" does not work. I'm sure my <script></script> is incorrect, but don't know what it should be. Please view below:

    <select id="ddl_example6" name="ddl_example6" style="font-size:10px; width: 220px;">
    <option selected="selected">- Select Activity-</option>
    <option value="/find-your-trip/hiking//">Hiking Tours</option>
    <option value="/find-your-trip/kayaking/"> Kayaking Tours</option>
    <option value="/find-your-trip/lodge-based-adventures/">Lodge Based Adventures</option>
    </select>
    <script>
    function setSelectedIndex(s, valsearch)
    {
    // Loop through all the items in drop down list
    for (i = 0; i< s.options.length; i++)
    {
    if (s.options[i].value == valsearch)
    {
    // Item is found. Set its property and exit
    s.options[i].selected = true;
    break;
    }
    }
    return;
    }
    setSelectedIndex(document.getElementById("ddl_example5"),"/destinations/grand-canyon-hiking-backpacking/">");
    </script>

    Thank you for any help.

  2. Good Guy
    Member
    Posted 1 year ago #

    Your theme should be able to do it for you automatically. All modern themes running on 3.4.2 are capable of drop-down-menus. what is your theme called?

  3. Wish Web Geek
    Member
    Posted 1 year ago #

    I created the theme, but I can't see how to make it a drop down.

Topic Closed

This topic has been closed to new replies.

About this Topic