Solved

Firefox and radio buttons

Posted on 2009-05-15
7
481 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Several part series to implement Internet Explorer 11 Enterprise Mode
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now