Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Firefox Problem

  1. #1
    New Coder
    Join Date
    Jul 2005
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •