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 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code for linking dropdown listbox to frames

    Hi. Can anyone help me with a script? I want to create a website using frames. In the top frame, i will place logos, hyperlinks, and also a dropdown listbox that lists the different categories that the user may view. When the user selects a category from the dropdown listbox, I want the bottom frame to change so that a page loads that shows the category page that the user selected. (Example: Dropdown listbox has many option values: halloween, christmas, etc. User selects Halloween, and the top frame remains the same, but the bottom frame of the page loads and becomes the Halloween page).

    Can anyone help with a script where on select of a category from the listbox, the bottom frame of the webpage changes? Thanks.

    P.S. I'm using Javascript and ASP. Thanks again!
    -j3nnif3r.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Code:
    <script type="text/javascript">
    function go(sel){
       var idx = sel.selectedIndex;
       if (idx>0) window.open(sel.options[idx].value, 'nameOfTargetFrame');
    }
    </script>
    ...
    <select onchange="go(this)">
    <option value="">Select Category</option>
    <option value="halloween.htm">Halloween</option>
    <option value="christmas.htm">Christmas</option>
    </select>

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Glenngv.

    Maybe im inserting the script wrong, but i inserted the script into the top frame where my listbox would be, but instead of the category page populating in the bottom frame, a new window pops up. The entire document with both frames is called Template.htm, and the top frame is called topframe.htm, and the bottom frame is called bottomframe.htm. For the category pages, they are named Halloween.htm, Christmas.htm, etc. Am i doing something wrong? Can you help me with what I did wrong? Thanks again for your help. I really do appreciate it. Thanks again.

    -j3nnif3r.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Did you put the name of the bottom frame ?

    if (idx>0) window.open(sel.options[idx].value, 'bottomFrame');
    ...
    <frame name="bottomFrame" src="bottomframe.htm">


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •