StefiIOE

lab 3.3

Feb 10th, 2020
188
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. <h2>Volumen na cilindar</h2>
  10. <p>Vnesi radius</p>
  11. <p><input type="text" id="Radius"></p>
  12. <p>Vnesi visina</p>
  13. <p><input type="text" id="Visina"></p>
  14. <p><input type="button" value="Presmetaj volumen" onclick="Volume()"></p>
  15. <p id="Volumen"></p>
  16. </body>
  17. </html>
  18. <script>
  19.   class Cylinder {
  20.     constructor(radius, height) {
  21.       this.radius = parseInt(radius);
  22.       this.height = parseInt(height);
  23.  
  24.     }
  25.  
  26.     PresmetajVolumen() {
  27.       return this.height * this.radius * this.radius * 3.14;
  28.  
  29.     }
  30.   }
  31.   function Volume() {
  32.     var cilindar=new Cylinder(parseInt(document.getElementById('Radius').value), parseInt(document.getElementById('Visina').value));
  33.     document.getElementById('Volumen').innerHTML = cilindar.PresmetajVolumen();
  34.  
  35.   }
  36.  
  37. </script>
RAW Paste Data