Can someone assist me with a coding problem?
I have these 4 functions that I want to convert into a loop:
function Incr1(){
document.forms[0].NavigationButton.value='Next';
document.PledgeForm.FUDF9.value='Y1';
document.forms[0].submit();}
function Incr2(){
document.forms[0].NavigationButton.value='Next';
document.PledgeForm.FUDF9.value='Y2';
document.forms[0].submit();}
function Incr3(){
document.forms[0].NavigationButton.value='Next';
document.PledgeForm.FUDF9.value='Y3';
document.forms[0].submit();}
function Incr4(){
document.forms[0].NavigationButton.value='Next';
document.PledgeForm.FUDF9.value='Y4';
document.forms[0].submit();}
I've tried creating a loop for the functions, but it's not working as expected.
for (var i = 1; i < 5; i++) {
function 'Incr'+i(){
document.forms[0].NavigationButton.value='Next';
document.PledgeForm.FUDF9.value='Y'+i;
document.forms[0].submit();
}
}
Your guidance on this issue would be greatly appreciated!