Bob3975
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?
I tried q=getElementById("plyers")
<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>
can you post more code
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(fal se,4,docum ent.getEle mentById(" plyrs").ch ecked)'>
<input type='button' value='Go' onclick='javascript:aj(fal
ASKER
I believe getElementById("plyrs").ch ecked does not differentiate between the two buttons. As far as I can tell neither does getElementById("plyrs").va lue.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, it requires a unique id for each radio button and works in both browsers. IE would access as an array.
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.