codice:
<form name=exf1>
1<input type="checkbox" name="c1" onclick=showpicks() value="1">
2<input type="checkbox" name="c2" onclick=showpicks() value="2">
3<input type="checkbox" name="c3" onclick=showpicks() value="3">
4<input type="checkbox" name="c4" onclick=showpicks() value="4">
5<input type="checkbox" name="c5" onclick=showpicks() value="5">
6<input type="checkbox" name="c6" onclick=showpicks() value="6">
<input type=text onfocus=blur() name=t1 value="10">
</form>
<script type=text/javascript>
function showpicks() {
_s = "";
if (document.exf1.c1.checked) _s += "1 ";
if (document.exf1.c2.checked) _s += "2 ";
if (document.exf1.c3.checked) _s += "3 ";
if (document.exf1.c4.checked) _s += "4 ";
if (document.exf1.c5.checked) _s += "5 ";
if (document.exf1.c6.checked) _s += "6 ";
document.exf1.t1.value = _s;
}
</script>
E' possibile fare in modo che il valore di t1, inizialmente impostato uguale a 10, venga aumentato o diminuito, a secondo della selezione del checkbox, del valore di attribuzione dei vari checkbox?
Grazie