Sto provando a snellire un codice di questo tipo utilizzando un ciclo FOR:
Ho provato così, ma non va ("Costante String senza terminazione")codice:frm1 = document.getElementById('img1'); frm1.removeAttribute('disabled'); frm2 = document.getElementById('img2'); frm2.removeAttribute('disabled'); frm3 = document.getElementById('img3'); frm3.removeAttribute('disabled'); frm4 = document.getElementById('img4'); frm4.removeAttribute('disabled'); frm5 = document.getElementById('img5'); frm5.removeAttribute('disabled');
Sicuramente è un problema di sintassi.codice:for(i=1;i<=5;i++) eval("frm"+i+"=document.getElementById('img"+i+");"); for(i=1;i<=5;i++) { frm[i].removeAttribute('disabled'); }
Dove sbaglio?