Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function intval(val){
- return parseInt(val) || 0;
- }
- function calculateSum(){
- document.getElementById("inC").value = intval(document.getElementById("inA").value) + intval(document.getElementById("inB").value);
- }
- </script>
- A: <input type="text" name="a" id="inA" onchange="calculateSum()"><br>
- B: <input type="text" name="b" id="inB" onchange="calculateSum()"><br>
- C: <input type="text" name="c" id="inC" readonly><br>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement