Salut,

j'ai un problème pour afficher cette somme. J'suis trop nul en JS !
Voici un exemple:

Code html : 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
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <script language="javascript">
        function check(){
        var form = document.getElementById("form");
        var total= parseInt(form.MONT1.value) + parseInt(form.MONT2.value);// ...
        alert(Total: "+total"\n) ;
        }
        </script>
        <body>
        <form id="form" bgcolor="#6CF" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="application/x-www-form-urlencoded" onsubmit="return confirm('Confirmez?')">
        <fieldset >
        <legend></legend>
        <table bgcolor=#CFC>
        <tr>
        <td width="150">MONT1 </td>
        <td width="10"><input type="text" name="MONT1" size="20" maxlength="25"/></td></tr>
        <tr>
        <td>MONT2 </td>
        <td><input type="text" name="MONT2" size="20" maxlength="25"/></td></tr>
        <tr>
        <td><input type="reset" value=" Effacer " /></td>
        <td><input type="button" onclick="check()" value="total"/></td>
        </tr>
        </table>
        </fieldset>
        </form>
        </body>
        </html>