Prova cosi:
codice:
function cp(Sel){
if(Sel == "privato"){
document.modulo.ragsoc.disabled = true;
document.modulo.piva.disabled = true;
return false;
}else{
document.modulo.ragsoc.disabled = false;
document.modulo.piva.disabled = false;
return false;
}
if(Sel == "azienda") {
document.modulo.nome.disabled = true;
document.modulo.cognome.disabled = true;
return false;
}else{
document.modulo.nome.disabled = false;
document.modulo.cognome.disabled = false;
return false;
}
if(Sel == "scegli"){
alert("Opzione non amessa");
return false;
}
}
<body>
<select size="1" name="registrazione" onchange="return cp(this[this.selectedIndex].value);">
<option value="scegli">Scegli </option>
<option value="privato">Privato </option>
<option value="azienda">Azienda</option>
</select>
Nome <input name="nome" type="text">
Cognome <input name="cognome" type="text">
Ragione Sociale <input name="ragsoc" type="text">
Partita Iva <input name="piva" type="text">
</body>