...

View Full Version : Firefox Problem



scott100
07-13-2005, 01: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.

Thanks.

<html>

<head>

<script>



function checkintro()

{

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


if (assoc=="Please choose")

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

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



}







</script>

</head>



<body>


<form name="housingForm">

<table width="100%" border="0">
<tr>
<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%" />

<h2>APPLICATION FOR HOUSING</h2>

<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>
</select>

</td>

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

</td>

</tr>
</table>


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


<br />






</body>

</html>

SpirtOfGrandeur
07-13-2005, 01: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum