0
I have the following code and I wanted to improve it.
if(id == 1)
if(myWindow1){
myWindow1.form_1.submit();
myWindow1 = "";
}
if(id == 2)
if(myWindow2){
myWindow2.form_2.submit();
myWindow2 = "";
}
if(id == 3)
if(myWindow3){
myWindow3.form_3.submit();
myWindow3 = "";
}
if(id == 4)
if(myWindow4){
myWindow4.form_4.submit();
myWindow4 = "";
}
if(id == 5)
if(myWindow5){
myWindow5.form_5.submit();
myWindow5 = "";
}
where myWindow ... and a popup that may have been created. If I know the amount of popup that were created( and know ) could do more or less this way (as I do in PHP)
while($contador < $qtdAlgo){
$nomeVariavel = ${"myWindow". $contador}
$contador++;
}
So I would take all the variables that already exist and I could do something with them... There’s a way for me to keep my code up there { myWindow1.form_1.Submit() } ?
Obs. form_1 would also have to be concatenated.
or more or less like this
myWindow {counter} . form_{counter}. Ubmit();
You can do myWindow[counter]
– Sergio
It would be interesting to see how popups are created.
– Augusto Vasques