Ciao.
Ho questa pagina web nella quale le select CO e ZN si disabilitano a vicenda quando in una delle due viene selezionato una valore diverso da -1.
Come modifico la funzione javascript Attiva anche per evitare che nella terza select AUT non sia possibile selezionare il valore 2 quando si è selezionato il valore diverso da -1 nella select CO ?
Grazie---codice:function Attiva() { var sel = document.getElementById('CO'); var sel1 = document.getElementById('ZN'); if (sel.options[sel.selectedIndex].value != '-1') { document.getElementById('ZN').disabled = true; } else { document.getElementById('ZN').disabled = false; } if (sel1.options[sel1.selectedIndex].value != '-1') { document.getElementById('CO').disabled = true; document.getElementById('AUT').value = 2; document.getElementById('AUT').disabled = true; } else { document.getElementById('CO').disabled = false; } } <select size="1" name="CO" id="CO" onchange="Attiva();"> <option value="-1" selected="selected">- Seleziona -</option> ... </select> <select size="1" name="CO" id="ZN" onchange="Attiva();"> <option value="-1" selected="selected">- Seleziona -</option> ... </select> <select size="1" name="AUT" id="AUT"> <option>Seleziona</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select>

Rispondi quotando