Prev Demo
JavaScript
>
Addition
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Title</title> </head> <body> <h1>Addition</h1> <script type="text/javascript"> function Sum() { var a = document.getElementById("txtA").value; var b = document.getElementById("txtB").value; var result = parseInt(a) + parseInt(b); alert(result); } </script> Enter two digit: <input type="text" id="txtA" name="txtA" /> + <input type="text" id="txtB" name="txtA" /> <input type="button" name="btnAdd" value="Add" onclick="Sum()" /> </body> </html>
Note: We DO NOT save your trial code in our database.
Output