PDA

View Full Version : Hello all :) - Double Combo box problem.


sabbathcat
11-21-2002, 12:36 PM
Hi there, I'm new here and still a total n00b when it comes to Js, so apologies if I'm slow on the uptake.

Anyway, I'm having no luck whatsoever with my combo box, the basic code is this.


<form action="dummy" method="post">

<select name="where" size="1">
<option value="nill" selected>Select a folder</option>
<option value="one">one </option>
<option value="two">two</option>
<option value="three">three</option>
</select>
<select name="what" size="1">
<option value="nill.htm" selected>Select a page</option>
<option value="one.htm">one </option>
<option value="two.htm">two</option>
<option value="three.tm">three</option>
</select>

<input name="button" type="button" onClick="jump(this.form)" value="Search!">
</form>

Because of the nature of the site I'm working on, the upshot is, there are 50+ folders, all with identicle content, or at least, page names eg. butter.html eggs.html cakes.html etc. and the combo box I'm trying to make will hopefully allow the user to select the category (which is a folder) and the object within it, which will be a page, concatenate the strings so the "url" string at the end will be "where+what", so if the user selected one and two, it would got to www.thesitename.org/one/two.htm

Does that make sense?

Does anyone know what I'm doing wrong?

Do I need to make two forms? :P

Any help would be greatly apreciated.

Cheers

John

Spudhead
11-21-2002, 03:42 PM
looks pretty straightforward, try something like this:

function jump(whichFolder, whichPage){

var locationPath="http://www.mysite.com/"+whichFolder+"/"+whichPage;

window.location.href=locationPath;
}


and call it via:

<input type="button" value="Click me, you know you want to." onClick="jump('myfolder','mypage.html')">


Any use?

sabbathcat
11-21-2002, 04:50 PM
Spudhead- You rock man! :D

That's just awesome, thanks so much for taking the time to put something together. :thumbsup:

Cheers

John