PDA

View Full Version : Select Menu Wont Work In Firefox


tux
11-22-2007, 09:43 AM
Hi all,

I have a select menu that works fine in IE but wont work in Firefox or Netscape.

Here is the JS code......


<script language="javascript" type="text/javascript">

function submiter(){

id = document.getElementById('menu').value;

if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id
}

}
</script>


....and here is the Form Code.....

<form id="form1" name="form1" method="post" action="">
<div align="right">
<select name="menu" class="photographerlist" onChange="submiter()">
<option selected value="">choose a photographer</option>
<%
While (NOT rs_photographerlist.EOF)
%>
<option value="<%=(rs_photographerlist.Fields.Item("photographerID").Value)%>"><%=(rs_photographerlist.Fields.Item("firstname").Value)%>&nbsp;<%=(rs_photographerlist.Fields.Item("lastname").Value)%></option>
<%
rs_photographerlist.MoveNext()
Wend
If (rs_photographerlist.CursorType > 0) Then
rs_photographerlist.MoveFirst
Else
rs_photographerlist.Requery
End If
%>
</select>
</div>
</form>

Sorry about the rubbish ASP code, it was a hosting restriction at my camera club. I'm am slowly building it again in PHP.

Does anyone know why this will only work in IE and not in FF and NS.

Thanks.

davidj
11-22-2007, 09:56 AM
where you have


<select name="menu" class="photographerlist" onChange="submiter()">


give this an ID attribute (id="menu")

IE will treat the name attribute as an ID if it cant find an ID within your field tag. The other browsers require it.

tux
11-22-2007, 10:20 AM
Thanks David, all sorted. Easy when you know how!

Hows the vids coming on?

Regards, Paul