Salve a tutti, sto cercando disperatamente di risolvere un problema assurdo e del quale non capisco il senso della sua esistenza: avendo scritto questo SEMPLICISSIMO codice:
dovrebbe abilitarmi determinati radio e disabiliterne altri, giusto? per i primi due (pino e pinofj) funziona alla perfezione, nel terzo(rovere) con il codice che, francamente, non mi sembra AFFATTO errato, succede che selezionandolo è come se non effettuassi nessuna azione, quindi i radio "colore_legno" appartenenti alla parte del rovere (dal 10 al 14) MI RIMANGONO DISABILITATI A CAUSA DEGLI SCRIPT PRECEDENTI!!!
Mi chiedo davvero cosa sbaglio per avere questo assurdo problema!
HTML:
<section id="11">
<a href="#11"><h2 id="natura" style="color:rgba(221,0,5,1)">Natura del legno</h2></a>
<p>
<input type="radio" name="natura" value="Pino" onChange="
document.modulo.colore_legno[0].checked = true;
document.modulo.colore_legno[0].disabled = false;
document.modulo.colore_legno[1].disabled = false;
document.modulo.colore_legno[2].disabled = false;
document.modulo.colore_legno[3].disabled = false;
document.modulo.colore_legno[4].disabled = false;
document.modulo.colore_legno[5].disabled = true;
document.modulo.colore_legno[6].disabled = true;
document.modulo.colore_legno[7].disabled = true;
document.modulo.colore_legno[8].disabled = true;
document.modulo.colore_legno[9].disabled = true;
document.modulo.colore_legno[10].disabled = true;
document.modulo.colore_legno[11].disabled = true;
document.modulo.colore_legno[12].disabled = true;
document.modulo.colore_legno[13].disabled = true;
document.modulo.colore_legno[14].disabled = true;
document.modulo.natura.checked;
document.getElementById('natura').setAttribute('style', 'color:#000');
document.getElementById('colore_pino').setAttribute('style', 'color:red');
document.getElementById('colore_pinofj').setAttribute('style', 'color:#000');
document.getElementById('colore_rovere').setAttribute('style', 'color:#000');">Pino</input>
<br>
<input type="radio" name="natura" value="Pino F.J." onChange="
document.modulo.colore_legno[0].disabled = true;
document.modulo.colore_legno[1].disabled = true;
document.modulo.colore_legno[2].disabled = true;
document.modulo.colore_legno[3].disabled = true;
document.modulo.colore_legno[4].disabled = true;
document.modulo.colore_legno[5].checked = true;
document.modulo.colore_legno[5].disabled = false;
document.modulo.colore_legno[6].disabled = false;
document.modulo.colore_legno[7].disabled = false;
document.modulo.colore_legno[8].disabled = false;
document.modulo.colore_legno[9].disabled = false;
document.modulo.colore_legno[10].disabled = true;
document.modulo.colore_legno[11].disabled = true;
document.modulo.colore_legno[12].disabled = true;
document.modulo.colore_legno[13].disabled = true;
document.modulo.colore_legno[14].disabled = true;
document.modulo.natura.checked;
document.getElementById('natura').setAttribute('style', 'color:#000');
document.getElementById('colore_pino').setAttribute('style', 'color:#000');
document.getElementById('colore_pinofj').setAttribute('style', 'color:red');
document.getElementById('colore_rovere').setAttribute('style', 'color:#000');">Pino F.J.</input>
<br>
<input type="radio" name="natura" value="Rovere" onChange="
document.modulo.colore_legno[0].disabled = true;
document.modulo.colore_legno[1].disabled = true;
document.modulo.colore_legno[2].disabled = true;
document.modulo.colore_legno[3].disabled = true;
document.modulo.colore_legno[4].disabled = true;
document.modulo.colore_legno[5].disabled = true;
document.modulo.colore_legno[6].disabled = true;
document.modulo.colore_legno[7].disabled = true;
document.modulo.colore_legno[8].disabled = true;
document.modulo.colore_legno[9].disabled = true;
document.modulo.colore_legno[10].checked = true;
document.modulo.colore_legno[10].disabled = false;
document.modulo.colore_legno[11].disabled = false;
document.modulo.colore_legno[12].disabled = false;
document.modulo.colore_legno[13].disabled = false;
document.modulo.colore_legno[14].disabled = false;
document.modulo.natura.checked;
document.getElementById('natura').setAttribute('style', 'color:#000';
document.getElementById('colore_pino').setAttribute('style', 'color:#000');
document.getElementById('colore_pinofj').setAttribute('style', 'color:#000');
document.getElementById('colore_rovere').setAttribute('style', 'color:red');">Rovere</input>
<br>
</p>
</section>
Mi chiedo davvero cosa sbaglio per avere questo assurdo problema!
Ultima modifica: