Solved

Firefox and radio buttons

Posted on 2009-05-15
7
480 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 Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jquery, dropdown 4 37
.removeAttr() not working in my SharePoint JSOM code 8 37
onOpen 14 42
How to specify a browser 14 25
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

757 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

18 Experts available now in Live!

Get 1:1 Help Now