View Full Version : Code for linking dropdown listbox to frames

06-25-2004, 07:46 AM
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! :)

06-25-2004, 08:25 AM
<script type="text/javascript">
function go(sel){
var idx = sel.selectedIndex;
if (idx>0) window.open(sel.options.value, '[i]nameOfTargetFrame');
<select onchange="go(this)">
<option value="">Select Category</option>
<option value="halloween.htm">Halloween</option>
<option value="christmas.htm">Christmas</option>

06-25-2004, 10:19 PM
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.


06-28-2004, 02:23 AM
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">