Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Javascript problem

Opening page from drop down form into named frame



5:28 pm on Jan 25, 2003 (gmt 0)

10+ Year Member


I have a page with a drop down form where you select from the list and that page opens in the browser. Now I want to move that drop down form into a frame at the top and have the page selected in the form open in a frame at the bottom.

I've created the frame.html page, a top.html page, and a main.html page. The frame.html page contains this which works fine:

FRAME NAME="top" SRC="top.html">
FRAME NAME="main" SRC="main.html">

Within top.html is this in the head:

Script Language="javascript" Type = "text/javascript">

function jumpBox(list) { location.href = list.options[list.selectedIndex].value}


and this in the body:

FORM Action="">
SELECT Name="">
OPTION Value="1.html"> 1
OPTION Value="2.html"> 2
INPUT TYPE="button" VALUE="Go" onClick="jumpBox(this.form.elements[0])">

So, my question is: How can I make 1.html or 2.html open in the "main" frame? I've tried to add Target=main to these places:

OPTION Value="1.html TARGET=main">
OPTION Value="1.html" TARGET=main>
onClick="jumpBox(this.form.elements[0]) TARGET=main">
onClick="jumpBox(this.form.elements[0])" TARGET=main>

but those don't work.

As you can tell I'm not a javascript developer and am trying to hack my way through this. Any help is appreciated.


1:35 am on Jan 26, 2003 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

All you have to do is change the line
location.href = list.options[list.selectedIndex].value

to say
[b]main.[/b]location.href = list.options[list.selectedIndex].value


6:14 am on Jan 26, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Thanks, DrDoc - that's very elegant. I was thinking of a couple ways to answer, but you just cut to the chase.


9:54 pm on Jan 27, 2003 (gmt 0)

10+ Year Member

Thank you very much DrDoc.

Featured Threads

Hot Threads This Week

Hot Threads This Month