Cosi dovrebbe andare meglio. Occhio a non dare lo stesso nome o id a diversi elementi !!!!
codice:
<form name='tipo_form'>
<input type="checkbox" checked name='cb_registrati' onclick="mostraReg()">Registrazione al sito
<input type="checkbox" checked name='cb_informazioni' onclick="mostraInf()">Richiesta informazioni
</form>
<script>
function mostraReg() {
if (document.tipo_form.cb_registrati.checked) {
document.getElementById('div_registrati').style.visibility = "visible";
}
else {
document.getElementById('div_registrati').style.visibility = "hidden";
}
}
function mostraInf() {
if (document.tipo_form.cb_informazioni.checked) {
document.getElementById('div_informazioni').style.visibility = "visible";
}
else {
document.getElementById('div_informazioni').style.visibility = "hidden";
}
}
</script>
<div id="div_registrati">
<form name="registrati">
<table width="30%">
<tr>
<td colspan="2">Registrati al sito</td>
</tr>
<tr>
<td>Nome:</td>
<td><input type="textbox" name="Nome"></td>
</tr>
<tr>
<td>Cognome</td>
<td><input type="textbox" name="cognome"></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="textbox" name="email"></td>
</tr>
<tr>
<td>Telefono:</td>
<td><input type="textbox" name="telefono"></td>
</tr>
<tr>
<td>Città:</td>
<td><input type="textbox" name="città"></td>
</tr>
<tr>
<td><input type="submit" value="Registrati"></td>
<td></td>
</tr>
</table>
</form>
</div>
<div id="div_informazioni">
<form name="informazioni">
<table width="30%">
<tr>
<td colspan="2">Richiesta informazioni</td>
</tr>
<tr>
<td>Nome:</td>
<td><input type="textbox" name="Nome"></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="textbox" name="email"></td>
</tr>
<tr>
<td>Richiesta</td>
<td><textarea name="richiesta" cols="20" rows="10"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="Registrati"></td>
<td></td>
</tr>
</table>
</form>
</div>