Advertisement
arxeiss

OnChange show

Jan 23rd, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.43 KB | None | 0 0
  1. <script>
  2. function intval(val){
  3.     return parseInt(val) || 0;
  4. }
  5. function calculateSum(){
  6.    document.getElementById("inC").value = intval(document.getElementById("inA").value) + intval(document.getElementById("inB").value);
  7. }
  8. </script>
  9.  
  10. A: <input type="text" name="a" id="inA" onchange="calculateSum()"><br>
  11. B: <input type="text" name="b" id="inB" onchange="calculateSum()"><br>
  12. C: <input type="text" name="c" id="inC" readonly><br>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement