codice:
<head>
<script type="text/javascript">
function applyOpt(cb) {
if (cb == undefined) cb = false;
var opzioni = new Array();
var selopt = document.getElementById('opzioni');
while(selopt.options.length > 0) selopt.removeChild(selopt.options[0]);
if (cb) {
opzioni.push('A');
opzioni.push('B');
opzioni.push('D');
}
else {
opzioni.push('C');
}
for (i=0; i<opzioni.length; i++) {
opt = document.createElement('option');
opt.setAttribute('value', opzioni[i]);
opt.setAttribute('text', opzioni[i]);
opt.innerHTML = opzioni[i];
selopt.appendChild(opt);
}
}
</script>
</head>
<body onload="applyOpt(document.getElementById('opzioni').checked)">
<input type="checkbox" onclick="applyOpt(this.checked)" />
<select id="opzioni">
</select>
</body>
Ciao
-Fab-
Keywords: contenuto valori option select determinati dipendenti scelta checkbox