User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » automatic drop down list, doesn't work in Firefox Page [1]  
Novicane
All American
15416 Posts
user info
edit post

I wanted a drop list, when the users picked an item, it automatically went to it instead of having hit a button. I found a script that worked:

<script language=JavaScript>

function Navigate() {
var number = NavSelect.selectedIndex;
location.href = NavSelect.options[number].value; }

</script>



<select name="NavSelect" onChange="Navigate(this.form)">
<option value="" selected>Quick Select</option>
<option value="prod1.php">product 4/option>
<option value="prod2.php">product 3</option>
<option value="prod3.php">product 3</option>
</select>



but it only works in IE. When i select an item in safari/firefox it doesn't work. any help is appreciated on making this work across browsers.

4/7/2009 1:48:18 PM

kiljadn
All American
44690 Posts
user info
edit post

nmind you wanted a list

[Edited on April 7, 2009 at 2:06 PM. Reason : .]

4/7/2009 2:06:11 PM

RSXTypeS
Suspended
12280 Posts
user info
edit post

^^aren't you missing the form tags so you can reference it with...

document.formName.elementName

4/7/2009 2:24:25 PM

agentlion
All American
13936 Posts
user info
edit post

can probably look through the source of TWW and just do what it does

4/7/2009 2:33:37 PM

RSXTypeS
Suspended
12280 Posts
user info
edit post

if i'm understanding what you want to do right all you have to do is...

window.location = document.formName.formElementName.value

and that will work in all browsers.

4/7/2009 2:34:59 PM

Novicane
All American
15416 Posts
user info
edit post

did away with the function and just used it within the form code. This worked for me:


<form name="f2">
<select name="NavSelect" onChange="window.location=document.f2.NavSelect.options[document.f2.NavSelect.selectedIndex].value">
..

4/7/2009 2:51:55 PM

RSXTypeS
Suspended
12280 Posts
user info
edit post

^you don't need the .options.etc.etc

when you select an option in the drop down the value of the dropdown becomes the value of the option.

so document.f2.NavSelect.value would work too.

4/7/2009 2:55:19 PM

 Message Boards » Tech Talk » automatic drop down list, doesn't work in Firefox Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.