Advertisement
weeez

Bálintka

Sep 17th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <script>
  5.         function myFunction() {      
  6.             var a = parseInt(document.getElementById("valtozo_a").value),
  7.                 b = parseInt(document.getElementById("valtozo_b").value);
  8.        
  9.             if(!isNaN(a) || !isNaN(b)){
  10.                document.getElementById("eredmeny_value").innerHTML =  a + b;
  11.             }else{
  12.                document.getElementById("eredmeny_value").innerHTML = "hibás input";
  13.             }
  14.         }
  15.     </script>
  16. </head>
  17. <body>
  18.        <p><input id="valtozo_a" type="text"></p>
  19.        <p><input id="valtozo_b" type="text"></p>
  20.        <button type="button" onclick="myFunction()">Osszegezd!</button>
  21.        <br>
  22.        <p>Eredmeny: </p>
  23.        <p id="eredmeny_value"></p>
  24. </body>
  25. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement