Click to See Complete Forum and Search --> : Multiple Pulldown Menus on 1 Page...


weatherman2525
08-10-2003, 12:32 PM
Hi,

I am trying to put multple pulldown menus on one page, but no matter what I do only the very last one works and all the others do not. Any help how to fix this would be very much appreciated. Here is an example page of my problem:

http://www.adamsweather.com/test.htm

Thanks in advance,
Adam

David Harrison
08-10-2003, 03:06 PM
Well I had a quick flick through your code and the first error I spotted was this:

var myindex=form.select7.selectedIndex

which should be:

var myindex=document.form.select7.selectedIndex

You've missed off the document. quite a few times in the script so try correcting all of those and see if there's a difference.

Edit: I've written a script that will re-locate the user depending on a choice they make in a select box, but they have to press a button first. There are two of them on a page though so you could easily modify that. Just say the word and I'll upload it.

David Harrison
08-10-2003, 03:15 PM
Hmm..., I've just spotted my error, ignore the bit about document. in my last post. I realise no that "form" was an arguement in a function. Unfortunately you made the function twice:

function surfto(form) {
var myindex=form.select6.selectedIndex
if (form.select6.options[myindex].value != 0) {
location=form.select6.options[myindex].value;}
}

and:

function surfto(form) {
var myindex=form.select7.selectedIndex
if (form.select7.options[myindex].value != 0) {
location=form.select7.options[myindex].value;}
}

Anyway I'll go away now and modify your script, back in a couple of mins, in the mean time this is my script:

David Harrison
08-10-2003, 03:41 PM
Here ya go, this is your script made to work, on the face of it may look a lot different but the main bulk of it is still there:

weatherman2525
08-10-2003, 04:41 PM
Is it possible you can make each menu a separate form and not 1? Thanks for all your help, it has been very much appreciated as I do not know much about JavaScript.

Adam

David Harrison
08-10-2003, 04:54 PM
Well I'm not sure why you'd want them in different forms but here you go:

weatherman2525
08-10-2003, 05:00 PM
That works! Thank you so much! :)

Take care,
Adam

David Harrison
08-10-2003, 05:12 PM
Happy to help. :)