homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Javascript problem
Opening page from drop down form into named frame

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


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)

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)

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)

Thank you very much DrDoc.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved