prova così:
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function Riempi(f) {
var v1=f.nomecampo1.value;
var v2=f.nomecampo2.value;
var k=0;
if (v1=="" && v2=="") {
alert("Compilare entrambi i campi!");
f.nomecampo1.focus();
f.nomeselect.options.length=0;
f.nomeselect.disabled=true;
return;
}
for (var i=1; i<3; i++)
if (f.elements["nomecampo"+i].value!="") {
f.nomeselect.options[k]=new Option(f.elements["nomecampo"+i].value, f.elements["nomecampo"+i].name);
k++;
}
f.nomeselect.disabled=false;
f.nomeselect.options.length=k;
}
</script>
</head>
<body>
<form name="f">
<input type="text" name="nomecampo1">
</p>
<input type="text" name="nomecampo2">
<input type="button" name="Submit" value="Pulsante" onClick="Riempi(f);">
</p>
</p><select name="nomeselect" disabled></select>
</form>
</body>
</html>
ciao