Bonjour a tous, je bute depuis deux trois jours sur un ptit problème...
En fait, j'ai trois boutons radio reprenant trois taux de tva différents... Je voudrais que ma fonction récupére ce taux pour l'employer... Malheureusement, j'ai du faire une erreur car cela ne fonctionne pas... et je ne vois pas ma faute. Quelqu'un se sentirait-il l'ame d'un correcteur??
voici mon formulaire
et voici ma fonction
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44 <form action="<?php echo $enregistrement; ?>" method="POST" name="Insertion" id="Insertion"> <table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#333333"> <tr bgcolor="#999999"> <th width="17" bgcolor="#333333" scope="col"><span class="Style7"></span></th> <th width="300" bgcolor="#333333" class="titlebar" scope="col"><div align="left"> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><span>Dénomination: </span></td> <td><span >TVA: <label> <input type="radio" name="TVA" value="1.06" id="TVA"> 6%</label> <label> <input type="radio" name="TVA" value="1.12" id="TVA"> 12%</label> <label> <input name="TVA" type="radio" id="TVA" value="1.21" checked> 21%</label> </span></td> </tr> </table> </div></th> <th width="134" bgcolor="#333333" scope="col"><div align="left" ><strong>Pv HTVA: </strong></div></th> <th width="134" bgcolor="#333333" scope="col"><div align="left" ><strong>Pv TVAC: </strong></div></th> <th width="50" bgcolor="#333333" scope="col"><div align="left" ><strong>Quantité</strong></div></th> <th width="134" bgcolor="#333333" scope="col"><div align="left" ><strong>Pv TTC: </strong></div></th> <th bgcolor="#333333" scope="col"><span >Remarques:</span></th> <th width="20" bgcolor="#333333" scope="col"><span class="Style7"></span></th> <th width="20" bgcolor="#333333" scope="col"><span ></span></th> </tr> <tr> <td align="left" valign="top" bgcolor="#333333"><input name="IdDevis" type="hidden" id="IdDevis" value="<?php echo $row_rsDevis['IdDevis']; ?>"/></td> <td align="left" valign="top" bgcolor="#333333"><input name="Denomination" type="text" id="Denomination" size="40"/></td> <td align="left" valign="top" bgcolor="#333333"><input name="PVHTVA" type="text" value="0" size="10" onChange="calcul()"/></td> <td align="left" valign="top" bgcolor="#333333"><input name="PVTVAC" type="text" value="0" size="10" onChange="calcul2()"/></td> <td align="left" valign="top" bgcolor="#333333"><input name="Quantity" type="text" value="1" size="2" onChange="calcul3()" /></td> <td align="left" valign="top" bgcolor="#333333"><input name="PVTVACTOTAL" type="text" id="PVTVACTOTAL" value="0" size="10" readonly="true"/></td> <td align="left" valign="top" bgcolor="#333333"><input name="Remarque" type="text" id="Remarque" size="30" /></td> <td align="left" valign="top" bgcolor="#333333"><input type="submit" name="Submit" value="V" /></td> <td align="left" valign="top" bgcolor="#333333"><input type="reset" name="Reset" value="X" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="Insertion" /> </form>
je vous passe les autres fonctions.
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 function calcul() { for(i=0,i<="3",i++){ if(document.Insertion.TVA[i].checked){ var tva =parseFloat(document.Insertion.TVA[i].value); } } var pvhtva = parseFloat(document.Insertion.PVHTVA.value); var pvtvac = parseFloat(document.Insertion.PVTVAC.value); var pvttc = parseFloat(document.Insertion.PVTVACTOTAL.value); var quantity = parseFloat(document.Insertion.Quantity.value); //Si le pvhtva a été modifié, alors... if (pvhtva !='0') { //Calculer et afficher pvtvac pvtvac = (pvhtva*tva); document.Insertion.PVTVAC.value = pvtvac; //Calculer et afficher pvttc pvttc = (pvhtva*tva)*quantity; document.Insertion.PVTVACTOTAL.value = pvttc; } }
Donc, comment récuperer la valeur de la case a cocher TVA?
merci a tous...
Partager