Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Addition Andy</title>
- </head>
- <body>
- <input type="number" id="val1" placeholder="Valeur 1" required />
- <input type="number" id="val2" placeholder="Valeur 2" required />
- <button id="calcul" onclick="calcul();">Additionner</button>
- <script type="text/javascript">
- function calcul() {
- var val1 = parseInt(document.getElementById('val1').value);
- var val2 = parseInt(document.getElementById('val2').value);
- var resultat = val1+val2;
- alert('Le résultat de ' + val1 + ' + ' + val2 + ' est ' + resultat);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement