Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Radio Buttons work in IE but don't work in FireFox

Posted on 2011-03-21
7
Medium Priority
?
296 Views
Last Modified: 2012-05-11
the following works in IE but not in Firefox. Please help:

function test()
      {
          var rM = document.getElementsByName('rMonthly');
        rM[0].checked = true;
      }

<a href="javascript:test();">test</a>
    <input id="rMonthly" runat="server" type="radio" name="rSubscription" value="Monthly" /><b>Monthly</b>
   
0
Comment
Question by:wilcor14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 35184988
Corrected :

note : the name is rSubscription not rMonthly
function test() {
   var rM = document.getElementById('rMonthly');
   rM.checked = true;
}

<a href="javascript:test();">test</a>
<input id="rMonthly" type="radio" name="rSubscription" value="Monthly" /><b>Monthly</b>

Open in new window

0
 

Author Comment

by:wilcor14
ID: 35190716
Thanks leakim971

But what if I have multiple radio buttons such as:
<input id="rMonthly" type="radio" name="rSubscription" value="Monthly" /><b>Monthly</b>
<input id="rBiAnnual" type="radio" name="rSubscription" value="BiAnnual" /><b>BiAnnual</b>
0
 
LVL 82

Expert Comment

by:leakim971
ID: 35190859
what do you want to do ?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:wilcor14
ID: 35190971
I want to select the rMonthly radio button. Your suggestion mentions that it should be the name is rSubscription not rMonthly. Well, there are now 2 rSubscription names so that won't work right?
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 35190993
no, I use the ID instead the name. ID must be unique in a page. It's your case so no problem.

input id="rMonthly" t
input id="rBiAnnual"

function test() {
   var rM = document.getElementById('rMonthly');
   rM.checked = true;
}
0
 

Author Comment

by:wilcor14
ID: 35191412
Yes, this in my dilemma. It works fine in IE but not in FireFox.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 35194716
the code is fine, the error is somewhere else
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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)
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…

609 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