Forum de discussion
Forum « Programmation Javascript » (archives)
Re: bon de commande
Envoyé: 8 juin 2005, 4h47 par harlock59
d'avance, merci
function calcul()
{
document.getElementById('result').value = document.getElementById('qte').value * document.getElementById('pu').value; }
et:
<form name='formu'>
<tr>
<td width=30%>Nom de l'article</td>
<td width=25%>Quantité</td>
<td width=25%>Prix unitaire</td>
<td width=20%>Prix Total</td>
<td width=10%>Référence</td>
</tr>
<tr>
<td width=30%>produit n°1</td>
<td width=25%>Qté :
<input type=text size=1 id='qte' value='0' onChange='calcul()'>
</td>
<td width=25%><id='pu'>10.00 €</id></td>
<td width=20%><input type='text' disabled name='resultat' id='result' value='0'></input></td><td width=10%>001</td></tr><tr>
<td width=30%>produit n°2</td>
<td width=25%>Qté :
<input type=text size=1 id='qte' value='0' onChange='calcul()'>
</td>
<td width=25%><id='pu'>9.00 €</id></td>
<td width=20%><input type='text' disabled name='resultat' id='result' value='0'></input></td><td width=10%>002</td></tr><tr>
<td width=30%>produit n°3</td>
<td width=25%>Qté :
<input type=text size=1 id='qte' value='0' onChange='calcul()'>
</td>
<td width=25%><id='pu'>15.00 €</id></td>
<td width=20%><input type='text' disabled name='resultat' id='result' value='0'></input></td><td width=10%>003</td></tr><tr>
<td width=30%>produit n°4</td>
<td width=25%>Qté :
<input type=text size=1 id='qte' value='0' onChange='calcul()'>
</td>
<td width=25%><id='pu'>19.00 €</id></td>
<td width=20%><input type='text' disabled name='resultat' id='result' value='0'></input></td><td width=10%>004</td></tr><tr>
<td width=30%>produit n°5</td>
<td width=25%>Qté :
<input type=text size=1 id='qte' value='0' onChange='calcul()'>
</td>
<td width=25%><id='pu'>4.00 €</id></td>
<td width=20%><input type='text' disabled name='resultat' id='result' value='0'></input></td><td width=10%>005
</td>
</tr>
</form>
Réponses
|