Facebook
From 4ITSUZD6, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 58
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>Document</title>
  7. </head>
  8. <body>
  9.     <h5>Select your favorite Color:</h5>
  10.     <form action="">
  11.         <label for="radius">Radius</label><br>
  12.         <input type="text" name="Radius" id="radius"><br>
  13.         <label for="volume">Volume</label><br>
  14.         <input type="text" name="Volume" id="volume" placeholder="0.00" disabled>
  15.     </form>
  16.     <hr>
  17.     <button onclick="as()">Get Options</button>
  18.     <script>
  19.         function as()
  20.         {
  21.           const PI = 3.14159265359;
  22.           var x = document.getElementById("radius").value;
  23.           parseFloat(x);
  24.           var y = (4/3)* PI * (x*x*x);
  25.           y = y.toFixed(2);
  26.           document.getElementById("volume").value = y;
  27.         }
  28.     </script>
  29. </body>
  30. </html>