Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-13-2005, 01:38 PM   PM User | #1
scott100
New Coder

 
Join Date: Jul 2005
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
scott100 is an unknown quantity at this point
Firefox Problem

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>
scott100 is offline   Reply With Quote
Old 07-13-2005, 01:41 PM   PM User | #2
SpirtOfGrandeur
Regular Coder

 
Join Date: May 2005
Location: Michigan, USA
Posts: 566
Thanks: 0
Thanked 0 Times in 0 Posts
SpirtOfGrandeur is an unknown quantity at this point
Code:
<select name="housingAssoc" size="1" />
Should be:

Code:
<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.
SpirtOfGrandeur is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:30 PM.


Advertisement
Log in to turn off these ads.