Bonjour,
j'ai un petit calcul à faire avec javascript qui sert à additionner toutes les valeurs saisie par le client, dans une page html.
Mon problème est au niveau de l'execution du calcul quand le client valide son saisi par la touche entrée, non par le bouton valider.
Je vois rapidement le résultat du calcul s'afficher quand on appuie sur entrée mais il n'est pas afficher dans la page précédente. Il n'est pas pris en compte peut être par la methode POST?!?
Mon but est d'effectuer le calcul quand on quitte au fur et mesure chaque champs de saisi, ou quand on quitte la page.
Tout marche bien pour tous les autres évenement que window.onunload
page1 :
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 <html><!--ouverture de la page html--> <head><!--ent-tête de la page html--> <title>PROLOG</title> <script language="JavaScript"><!-- debut script window.onunload = calcultotADL; //fonction calcul de la clairance function calcultotADL() { var a = parseInt(document.form2.corpo.value); var b = parseInt(document.form2.toilette.value); var c = parseInt(document.form2.continence.value); var d = parseInt(document.form2.habillage.value); var e = parseInt(document.form2.locomotion.value); var f = parseInt(document.form2.repas.value); var totalADL; totalADL = a+b+c+d+e+f; document.form2.totADL.value=totalADL; } --></script> </head> <body> <form name="form2" method="POST" action="verifevalfonction.php5"> <table> <tr> <!--ADL--> <td align="center"> <b>Hygiène corporelle </b><input type="text" name="corpo" size="2" maxlength="1" onBlur="calcultotADL()" <?php print ("value=".$_SESSION['corpo']);?>><br><br> <b>Aller au toilettes </b><input type="text" name="toilette" size="2" maxlength="1" onBlur="calcultotADL()" <?php print ("value=".$_SESSION['toilette']);?>><br><br> <b>Continence </b><input type="text" name="continence" size="2" maxlength="1" onBlur="calcultotADL()" <?php print ("value=".$_SESSION['continence']);?>><br><br> <b>Habillage </b><input type="text" name="habillage" size="2" maxlength="1" onBlur="calcultotADL()" <?php print ("value=".$_SESSION['habillage']);?>><br><br> <b>Locomotion </b><input type="text" name="locomotion" size="2" maxlength="1" onBlur="calcultotADL()" <?php print ("value=".$_SESSION['locomotion']);?>><br><br> <b>Repas </b><input type="text" name="repas" size="2" maxlength="1" onBlur="calcultotADL()" <?php print ("value=".$_SESSION['repas']);?>><br><br> </td> </tr> </table> <center><input type="submit" value="valider" onClick="calcultotADL()" onClick="calcultotIADL()"></center> </form>
Partager