Rieccomi![]()
Ciaocodice:<script type="text/javascript"> function controllaSomma() { a = (document.getElementById('a').value)-0; b = (document.getElementById('b').value)-0; c = (document.getElementById('c').value)-0; d = (document.getElementById('d').value)-0; e = (document.getElementById('e').value)-0; somma = a+b+c+d+e; if (somma > 10) { window.alert("Attenzione! La somma totale deve essere al massimo 10!"); document.getElementById('invia').disabled = true; } else { document.getElementById('invia').disabled = false; } document.getElementById('sommaparz').innerHTML = "Somma: "+somma; } </script> <form id="form1" name="form1" method="post" action=""> <label> <select name="a" id="a" onChange="controllaSomma();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </label> <select name="b" id="b" onChange="controllaSomma();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <select name="c" id="c" onChange="controllaSomma();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <select name="d" id="d" onChange="controllaSomma();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <select name="e" id="e" onChange="controllaSomma();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> il valore totale non deve superare 10 <div id="sommaparz">Somma: 5</div> <input type="submit" value="Ok" id="invia"> </form>![]()