Link to home
Start Free TrialLog in
Avatar of Bob3975
Bob3975Flag for United States of America

asked on

Firefox and radio buttons

The code below works in IE 7.0 but not Firefox 3.0.6.  Firefox error console says "Warning: Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead." and "Error: plyrs[0] is undefined".

I tried q=getElementById("plyers") but q doesn't seem to contain the needed info.  How do I determine which radio button is checked in FF?
<script>function aj(a,b,c){}</script>
<table>
<tr>
<td style='font-family: arial,helvetica,verdana,lucida,sans-serif; font-size: 10pt;'>
<input type='radio' value='1' id='plyrs' name='plyrs' checked>Choose from pitchers on specific team(s).
</td>
<td rowspan=2>
<input type='button' value='Go' onclick='javascript:aj(false,4,plyrs[0].checked)'>
</td>
</tr>
<tr>
<td style='font-family: arial,helvetica,verdana,lucida,sans-serif; font-size: 10pt;'>
<input type='radio' value='2' name='plyrs'>Choose from pitchers in the league.
</td>
</tr>
</table>

Open in new window

Avatar of erikTsomik
erikTsomik
Flag of United States of America image

can you post more code

Avatar of Bob3975

ASKER

There really is no more relevant code as the code posted will produce the error.  Just copy and save the code to a file and open with FF.
try this:
<input type='button' value='Go' onclick='javascript:aj(false,4,document.getElementById("plyrs").checked)'>
Avatar of Bob3975

ASKER

I believe getElementById("plyrs").checked does not differentiate between the two buttons.  As far as I can tell neither does getElementById("plyrs").value.
ASKER CERTIFIED SOLUTION
Avatar of alien109
alien109
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob3975

ASKER

Yes, it requires a unique id for each radio button and works in both browsers.  IE would access as an array.
Avatar of Bob3975

ASKER

The solution requires a unique id for each radio button and works in IE and FF.  IE could access as an array (id[0]) when both id's were the same.