Advertisement
RokiAdhytama

Volume - Chapter 10

Jun 26th, 2022
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.82 KB | None | 0 0
  1. <html xmlns = "http://www.w3.org/1999/xhtml">
  2.    <head>
  3.       <title>Calculating Sphere Volumes</title>
  4.  
  5.       <script type = "text/javascript">
  6.          <!--
  7.         function displayVolume()
  8.         {
  9.            var radius = parseFloat( myForm.radiusField.value );
  10.            window.status = "Volume is " + sphereVolume( radius );
  11.         }
  12.  
  13.         function sphereVolume( r )
  14.         {
  15.            return ( 4.0 / 3.0 ) * Math.PI * Math.pow( r, 3 );
  16.         }
  17.         // -->
  18.       </script>
  19.  
  20.    </head>
  21.  
  22.    <body>
  23.       <form name = "myForm" action = "">
  24.          Enter radius of sphere<br />
  25.          <input name = "radiusField" type = "text" />
  26.          <input name = "calculate" type = "button" value = "Calculate"
  27.                onclick = "displayVolume()" />
  28.       </form>
  29.    </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement