View Full Version : Firefox Problem

07-13-2005, 02:38 PM
Can anyone tell me why this code does not work in Firefox, it seems to be a problem with getElementById as i have tried accessing the info using the form name and it works ok, i need to access it using getElementById though. Opera and IE work ok.





function checkintro()


var assoc=document.getElementById('housingAssoc').value;

if (assoc=="Please choose")

{alert("You must choose a Housing association");}

{alert("Thank you for choosing "+assoc+"");}





<form name="housingForm">

<table width="100%" border="0">
<td width="25%" align="center" valign="top"></td>
<td width="50%" align="center">

<h2>Glasgow City's Housing Association</h2>

<hr color="black" width="90%" />


<br />

Please choose a housing association?<br /><br />

<select name="housingAssoc" size="1" />
<option value="Please choose">Please choose</option>
<option value="Biell">Biell</option>
<option value="Cloch Housing">Cloch Housing</option>
<option value="Rosehill Housing">Rosehill Housing</option>


<td width="25%" align="center" valign="top"></div>



<input type="button" class="button" value="Next -&gt;&gt;" onClick="checkintro()"/>

<br />



07-13-2005, 02:41 PM
<select name="housingAssoc" size="1" />

Should be:

<select name="housingAssoc" id="housingAssoc" size="1" />

FF actually checks for only the ID attribute instead of the name attribute also like IE and O.