Radio Button avec une function(afficher une image et du texte)
Bonjour,
Je debut en javascript et j'aimerai savoir pourquoi ceci affiche tjs la meme chose
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <script language="javascript">
function Ssalon(salon) {
if(document.reserve.salon.value="Petit")
{
document.getElementById('Isalon').innerHTML='<img src="/images/salont.png"> ';
document.getElementById('Tsalon').innerHTML='bla bla ';
}
else if(document.reserve.salon.value="Paris")
{
document.getElementById('Isalon').innerHTML='<img src="/images/salon.jpg"> ';
}
else
{ }
}
</script> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <form id="reserve" name="reserve"><table width="100%" border="0">
<tr>
<td colspan="3"><div align="center">Réservation</div></td>
</tr><tr>
<td colspan="3" class="course">Vos coordonnées</td>
</tr>
<tr>
<td colspan="3">choix de salon</td>
</tr>
<tr>
<td><input name="salon" type="radio" value="Petit" onchange="Ssalon(this.value);" />Le petit caveau<br />
<input name="salon" type="radio" value="Paris" onchange="Ssalon();"/>La parisienne<br />
<input name="salon" type="radio" value="Mémé" onclick="Ssalon();" />Chez Mémé<br />
<input name="salon" type="radio" value="Double" onclick="Ssalon();" />Double menton</td>
<td><div id="Isalon"></div></td>
<td><p id="Tsalon"></p></td>
</tr>
</table></form> |
En gros, avec un radio button j'aimerai faire afficher une image et un texte différent a chaque selection. Presentement ca marche mais c'est tjs la meme image qui affiche. C'est la variable qu'il ne voit pas correctement
merci