Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't clear radio buttons in Firefox, works in IE and Safari 1

Status
Not open for further replies.

Trusts

Programmer
Feb 23, 2005
268
US
Hi all,

This one is driving me batty! Here is a small routine that is meant to clear any radio button of the group named "course_single". There are 5 radio buttons in the group. This routine is called from other events on the form.

This works in IE and Safari, but does not work in Firefox. Any ideas why?? Thanks!



function update_selection_1() {
for (var i=0;i<dls_form.elements["course_single"].length; i++){
dls_form.elements["course_single"].checked=false;

}
}

 
Trusts, there is nothing wrong with your code, have just tested it through firefox.

Can you post more code or point us to your page?

Cheers

Nick
 
Sure, there are a set of radio buttons and a set of checkboxes. Clicking any radio button should clear any checked checkboxes - that works. Clicking any checkbox should clear all of the radio buttons - that is what does not work. If it is working for you, then that is encouraging! Here is the URL...

 
Ah ok, yeh IE will let you off with things like this but FF is a little more strict. The problem is that FF cannot initialise your form element.

Try this:

Code:
function update_selection_1() {
var mainform = document.forms.dls_form;
for (var i=0;i<mainform.elements["course_single"].length; i++){
   mainform.elements["course_single"][i].checked=false;

}
}

Cheers

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top