Solved

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

Posted on 2011-03-21
7
287 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
  • 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
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: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 500 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

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

920 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

16 Experts available now in Live!

Get 1:1 Help Now