Facebook
From asd, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 244
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4.         <meta charset="utf-8">
  5.         <title></title>
  6.                
  7. </head>
  8. <body>
  9.        
  10.         <input type="number" id="xd"></input>
  11.         <button type="button" id="b1" onclick="be1()">pole</button>
  12.         <button id="b2" onclick="be2()">obwod</button>
  13.         <p id="ww"></p>
  14.  
  15.         <script>
  16.        
  17.                 function be1(){
  18.                         var a = parseInt(document.getElementById("xd").value);
  19.                         if(isNaN(a)) {
  20.                                 document.getElementById("ww").innerHTML = "Należy wpisać wartość liczbową";
  21.                         } else {
  22.                                 document.getElementById("ww").innerHTML = "P=a^2="+a*a;
  23.                         }
  24.                 }
  25.                
  26.                 function be2(){
  27.                         var a = parseInt(document.getElementById("xd").value);
  28.                         if(isNaN(a)) {
  29.                                 document.getElementById("ww").innerHTML = "Należy wpisać wartość liczbową";
  30.                         } else {
  31.                                 document.getElementById("ww").innerHTML = "Obw = 4*a"+4*a;
  32.                         }
  33.                 }
  34.        
  35.         </script>
  36.        
  37.        
  38.        
  39. </body>
  40. </html>