StefiIOE

lab2.4

Feb 10th, 2020
164
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPEhtml>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.   <meta charset="utf-8"/>
  6.   <title>About Me</title>
  7. </head>
  8. <body>
  9. <form action="" id="zbir" method="post">
  10. <table>
  11.   <tr>
  12.     <td><input type="text" id="realen"></td>
  13.     <td><input type="text" id="imaginaren"> </td>
  14.   </tr>
  15.   <tr>
  16.     <td><input type="text" id="realen1"></td>
  17.     <td><input type="text" id="imaginaren1"></td>
  18.   </tr>
  19.   <tr>
  20.     <td><input type="button" value="Add" onclick="soberi()"></td>
  21.   </tr>
  22.   <tr>
  23.     <td>Zbitot e :</td>
  24.   </tr>
  25.   <tr>
  26.     <td><input type="text" id="Suma"></td>
  27.     <td><input type="text" id="Suma1"></td>
  28.   </tr>
  29. </table>
  30. </form>
  31. </body>
  32. </html>
  33. <script>
  34. function soberi() {
  35.   r=document.getElementById("realen").value;
  36.   r1=document.getElementById("realen1").value;
  37.   i=document.getElementById("imaginaren").value;
  38.   i1=document.getElementById("imaginaren1").value;
  39.   document.getElementById("Suma").value=parseInt(r)+parseInt(r1);
  40.   document.getElementById("Suma1").value=parseInt(i)+parseInt(i1);
  41. }
  42. </script>
RAW Paste Data