Facebook
From Cute Cockroach, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 234
  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <title> Kalkulator </title>
  5. </head>
  6. <SCRIPT LANGUAGE = "JAVASCRIPT">
  7. function oblicz1()
  8. {
  9.   var a = document.getElementById("a").value;
  10.   var b = document.getElementById("b").value;
  11.   var c = document.getElementById("c").value;
  12.   var wynik1 = parseInt(a)*parseInt(b)*2+parseInt(a)*parseInt(c)*4;
  13.   wynik.innerHTML="Pole prostopadłościanu= " +wynik1;
  14. }
  15. function oblicz2()
  16. {
  17.   var a = document.getElementById("a").value;
  18.   var b = document.getElementById("b").value;
  19.   var c = document.getElementById("c").value;
  20.   var wynik2 = parseInt(a)*parseInt(b)*parseInt(c);
  21.   wynik.innerHTML="Objętość prostopadłościanu= " +wynik2;
  22. }
  23.  
  24. </script>
  25.  
  26. <body>
  27. <h1><center>Kalkulator
  28.   <form name = "fomrmularz1">
  29.     <b>A:</b>
  30.     <input id = "a" type = "number" name="liczba1">
  31.     <br>
  32.     <b>B:</b>
  33.     <input id = "b" type = "number" name="liczba2">
  34.     <br>
  35.     <b>C:</b>
  36.     <input id = "c" type = "number" name="liczba1">
  37.     <br>
  38.     <input type = "button" value="Pole" onClick="oblicz1();">
  39.     <input type = "button" value="Objętość" onClick="oblicz2();">
  40.   </form>
  41.   <p id="wynik"></p>
  42. </center>
  43. </body>
  44.  
  45. </html>
  46. --------------------------------------------------------------------------------------------------------------
  47. <!DOCTYPE html>
  48. <head>
  49. <meta charset="UTF-8">
  50. <title> Kalkulator </title>
  51. </head>
  52. <SCRIPT LANGUAGE = "JAVASCRIPT">
  53. function oblicz1()
  54. {
  55.   var a = document.getElementById("a").value;
  56.   var wynik1 = parseInt(a)*parseInt(a)*6;
  57.   wynik.innerHTML="Pole sześcianu= " +wynik1;
  58. }
  59. function oblicz2()
  60. {
  61.   var a = document.getElementById("a").value;
  62.   var wynik2 = parseInt(a)*parseInt(a)*parseInt(a);
  63.   wynik.innerHTML="Objętość sześcianu= " +wynik2;
  64. }
  65.  
  66. </script>
  67.  
  68. <body>
  69. <h1><center>Kalkulator
  70.   <form name = "fomrmularz1">
  71.     <b>Bok sześcianu:</b>
  72.     <input id = "a" type = "number" name="liczba1">
  73.     <br>
  74.     <input type = "button" value="Pole" onClick="oblicz1();">
  75.     <input type = "button" value="Objętość" onClick="oblicz2();">
  76.   </form>
  77.   <p id="wynik"></p>
  78. </center>
  79. </body>
  80.  
  81. </html>
  82.