Ciao ragazzi ho un problema, praticamente devo fare comparire il secondo campo di una form quando seleziona "cane" nel primo campo...ho provato così con javascript ma non funziona..e non capisco xkè..chi può aiutarmi?grazie mille a tutti
codice:
<html>
<head>
<script language="javascript">
function SelectNewInput(obj, a)
{
var e = document.getElementById(a);
if(obj=="cane")
e.style.display="block";
else
e.style.display="none";
}
</script>
<title>Prova</title>
</head>
<body>
<div id="form">
<h3>Inserimento animale</h3></p>
<h4>Compilare la seguente form per selezionare un animale</h4>
<form method="POST" action="insert_annuncio.php" name="modulo">
<table>
<tr>
<td align="right">
Scegli:</td>
<td>
<select name="scelta_animale" onChange="SelectNewInput(this.options[this.selectedIndex].value, 'select');">
<OPTION value=cane>Cane</option>
<OPTION value=gatto>Gatto</option>
</select>
</td>
</tr>
<div id="select" style="display:none">
<tr>
<td align="right">
Razza:</td>
<td>
<input type="text" name="razza"></td>
</tr>
</div>
</table>
</form>
</body>
</html>