Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Firefox and radio buttons

Posted on 2009-05-15
7
Medium Priority
?
490 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
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.
Suggested Courses

927 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