Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- function performCalc()
- {
- var firstBox = parseInt(document.getElementById("num1").value);
- var secondBox = parseInt(document.getElementById("num2").value);
- var calcResult = firstBox + secondBox;
- document.average.result.value = calcResult;
- }
- </script>
- </head>
- <body>
- <form method="post" action="" name="average">
- <p>
- First number:
- <br>
- <input type="text" id="num1" name="num1" value="5"/>
- </p>
- <p>
- Second number:
- <br>
- <input type="text" id="num2" name="num2" value="4"/>
- </p>
- Final Result:
- <br>
- <input type="text" id="result" name="result"/>
- </p>
- <input type="button" value="Click me!" onclick="performCalc()" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement