View Full Version : how do I add a target in a dynamic pull down menu?

09-30-2003, 10:33 AM
My Page so far - pulldown.html (http://www.thatmiltonkeynesband.co.uk/pulldown.html)

Using the dynamic pull down menu page on javascriptkit (http://www.javascriptkit.com/howto/pulldown.shtml ) I am trying to use the first pulldown down box(which asks the user which season they are booking in) to alter the second one (which asks how many weeks, which are different prices depending on the season) and then rather than being directed to a page, it brings a price up in a text box, however in the dynamic pull down script I am using at the moment I do not know where to put the target to bring up the price in a text box, the code for the current array i have is as below :

var info = new Array(
"High Season2003*1 Weeks3|2 Weeks|3 Weeks|4 Weeks|5 Weeks",
"High Season2004*1 Weeks4|2 Weeks|3 Weeks|4 Weeks|5 Weeks",
"Mid Season2004*1 WeeksM|2 Weeks|3 Weeks|4 Weeks|5 Weeks",
"Low Season*1 WeeksL|2 Weeks|3 Weeks|4 Weeks|5 Weeks"

however I need to put the following information in for the weeks:

<select name="qtyA" size="1" onchange="return showPrice(this,'HIGH2004')" style="width:120px;">
<option value="0" selected="selected">Please Select</option>
<option value="1">1week</option>
<option value="2">2weeks</option>
<option value="3">3weeks</option>
<option value="4">4weeks</option>
<option value="5">5weeks</option>

does anyone know if this is possible?:confused:

Vincent Puglia
09-30-2003, 08:49 PM

would this (http://members.aol.com/grassblad/cascade3.html) help?

if your form looks like this:

sel1 sel2 txt1

sel2's tag should look like:

<select ....onchange="fillTextBox(this.options[this.selectedIndex].value)">
<option value='$9.99'>Atari 1200</option>


09-30-2003, 09:39 PM
Hi Vincent, thats exactly what I was looking for, thanks very much for your help!

Vincent Puglia
09-30-2003, 09:41 PM
Glad you like it :)

sometime next week, it should be at the main site:


with explanations and other features


09-30-2003, 10:20 PM
consider your site bookmarked :) i look forward to learning more (speaking as a complete javascript novice!) as I cant seem to get the final total to appear in the text box.. here (http://www.thatmiltonkeynesband.co.uk/pulldown_new.html) is how far I got, is there something I've done wrong along the way?

thanks vinny:thumbsup:

Vincent Puglia
09-30-2003, 10:30 PM
Hi billy,

...wrong along the way?

Well, in your case you really don't need a fillTextBox function.
This should do the trick:

<select name="items" onchange="this.form['Total'].value = this.options[this.selectedIndex].value">


10-01-2003, 01:03 PM
Hi thanks Vinny, I have that bit working now, but have spent the last half a day trying to get the total from the dynamic pull down menu form to be added into the grand total along with other calculations on the page, if you need to see what I'm talking about, what I've got so far is here (http://www.thatmiltonkeynesband.co.uk/test1.html) but all I seem to be getting is errors:confused:
any ideas if or how its fixable?


Vincent Puglia
10-01-2003, 01:38 PM
Hi billy,

why not the same way you do everything else? append your call to 'showprice' to the original onchange:
onchange='...xtotal=this.value.... ; showprice(...)'

or call a function with the onchange that does both:
function doit(....)
...xtotal = ....
...pricetotal +=.....


10-01-2003, 02:35 PM
the first second looks good, but I doubt my ability to know all the code to write the function and where to put it!

hmm .. maybe I should learn some more about javascript?

Vincent Puglia
10-01-2003, 03:15 PM
www.htmlgoodies.com -- tutorials
javascript in 25 hours -- book