Anciennes révisionsLiens de retourExporter en PDFHaut de page Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer RedditDerniers changementsSend via e-MailImprimerPermalien × Comment avoir un champ somme aditionnant dynamiquement des valeurs cochées avec js Output http://radeff.red/info/js/addjs.html Code html <SCRIPT LANGUAGE="JavaScript1.1"> function calculesomme() { value = document.forms[0].Inscription.checked; Inscription0910 = document.forms[0].Inscription0910.checked; Inscription1010 = document.forms[0].Inscription1010.checked; Inscription1110 = document.forms[0].Inscription1110.checked; if(value){ somme=220; } else { somme1=0; somme2=0; somme3=0; if(Inscription0910){ somme1=80; } if(Inscription1010){ somme2=80; } if(Inscription1110){ somme3=80; } somme=somme1+somme2+somme3; } document.forms[0].prix.value=somme; } </SCRIPT> <table><tr> <td colspan="2" valign="top" class="bodytext">Je m'inscris:<br /></td> </tr> <tr> <td width="6%" valign="top"><input name="Inscription" type="checkbox" value="Session" onChange="calculesomme()" /></td> <td width="94%" colspan="3" valign="top">à la session ( 3 journées) CHF 220.-</td> </tr> <tr> <td valign="top"><input name="Inscription0910" type="checkbox" value="9octobre" onChange="calculesomme()" /></td> <td colspan="3" valign="top">à la journée du 9 octobre "Aspects de l'histoire du toucher" CHF 80.-</td> </tr> <tr> <td valign="top"><input name="Inscription1010" type="checkbox" value="10octobre" onChange="calculesomme()" /></td> <td colspan="3" valign="top">à la journée du 10 octobre "Pratiques thérapeutiques actuelles du toucher " CHF 80.-</td> </tr> <tr> <td valign="top"><input name="Inscription1110" type="checkbox" value="11octobre" onChange="calculesomme()" /></td> <td colspan="3" valign="top">à la matinée du 11 octobre "Le toucher dans la pensée contemporaine" CHF 80.-</td> </tr> <tr> <td colspan="4" valign="top">Somme totale due correspondant à votre choix: CHF <input type="text" name="prix" size="6" maxlength="6" value="0" /></td> </tr> </table> info/calculer_la_somme_de_plusieurs_champs_additions_avec_js.txt Dernière modification : 2018/07/18 09:45de radeff S'identifier