Bonjour, je souhaite masquer sur un formulaire un champ "montant", puis le faire apparaître si le champ "Tarif" est sélectionné à "Payant" :

ici, le champ "montant" reste masqué...
merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />	
<title><?php echo $nom_site ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $nom_style ?>" />
<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
 
<!-- montant caché si tarif Gratuit -->
<script type="text/javascript">
function showT()
{	var elem = document.getElementById("idSelect");var elem2 = document.getElementById("idInput");if(elem.value.match("Gratuit"))
	{		elem2.style.display='none'		}	else	{		elem2.style.display='inline';tabindex=7;} }
<!-- fin de tarif caché si gratuit -->
</script>
</head>
<body>
<label for="ev6">Tarif &nbsp; : &nbsp; </label>
<br />
<select name="tarif" tabindex="7" id="idSelect">
<option value="Gratuit"> Gratuit </option>
<option value="Payant"> Payant </option>
</select>
<br />
<br />
<label type="hidden"  onchange="showT();" for="ev12">Montant &nbsp; : &nbsp; </label>
<br />
<input type="hidden"  tabindex="9" id="idInput" onchange="showT();" name="montant" class="ev" />
.....