Solved

Firefox and radio buttons

Posted on 2009-05-15
7
484 Views
Last Modified: 2013-12-07
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

0
Comment
Question by:Bob3975
  • 4
  • 2
7 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 24398454
can you post more code

0
 

Author Comment

by:Bob3975
ID: 24398478
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.
0
 
LVL 12

Expert Comment

by:alien109
ID: 24398582
try this:
<input type='button' value='Go' onclick='javascript:aj(false,4,document.getElementById("plyrs").checked)'>
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Bob3975
ID: 24398617
I believe getElementById("plyrs").checked does not differentiate between the two buttons.  As far as I can tell neither does getElementById("plyrs").value.
0
 
LVL 12

Accepted Solution

by:
alien109 earned 500 total points
ID: 24398626
the first radio has an id set, the other doesn't, so yes it will differentiate between the two.
0
 

Author Comment

by:Bob3975
ID: 24398750
Yes, it requires a unique id for each radio button and works in both browsers.  IE would access as an array.
0
 

Author Closing Comment

by:Bob3975
ID: 31582052
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.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question