Firefox says: Error: document.forms[0].C1 is not a function

Hi Coders,

I have a javascript function which lets a user to choose one of the 7 option buttons on a “mainsub.asp” page and the page will then be forwarded to one of the 7 process pages depending on what has been chosen.

The problem is that firefox is angry with the first line (“if” statement) and tells the following in its error console:

Error: document.forms[0].C1 is not a function
Source File: [localhost…]
Line: 117

Here is the code:

function fSubmit(){
if (document.forms[0].C1(0).checked) document.forms[0].action=“process.asp”;
else if (document.forms[0].C1(1).checked) document.forms[0].action=“process1.asp”;
else if (document.forms[0].C1(2).checked) document.forms[0].action=“process2.asp”;
else if (document.forms[0].C1(3).checked) document.forms[0].action=“process3.asp”;
else if (document.forms[0].C1(4).checked) document.forms[0].action=“process4.asp”;
else if (document.forms[0].C1(5).checked) document.forms[0].action=“process5.asp”;
else if (document.forms[0].C1(6).checked) document.forms[0].action=“process6.asp”;
else document.forms[0].action=“process.asp”;

Internet explorer does not complain about anything and does its job great.
But I could not figure out how to change the code to be also compliant with Firefox?

Thanks for all the comments.

C1 is not a function that uses parentheses, it is an array-like construct that uses square brackets instead.


Works great. thanks a lot