Form drop down help (null values)

M

mark

I'm trying to make a drop down menu, when you select a few options I want it
to do *nothing* at all, null. The following works perfectly in IE6, but it
doesn't seem to worm in Opera 6 and IE5. When I select the valued options,
then do nothing too. Can anyone please have a quick look @ this code and
help me out a little :


<form method="post" action="#">
<select name="dropdown" onChange="javascript:if (this.value !=
0){location.href(this.value)};">
<option value="">Please Choose...</option>
<option value="">~~~~~~~~~~~~~~</option>
<option value="1.php">Oranges</option>
<option value="2.php">Apples</option>
<option value=""></option>
</select>
</form>
 
S

Sergey I.Grachyov

Hi!

Use something like

if (this.options[this.selectedIndex].value) {location.href =
this.options[this.selectedIndex].value}

Here "selectedIndex" is # of selceted 'option'.
 
M

mark

Sergey I.Grachyov said:
Hi!

Use something like

if (this.options[this.selectedIndex].value) {location.href =
this.options[this.selectedIndex].value}

excellent!! that works great

many thanks

mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top