Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html xmlns = "http://www.w3.org/1999/xhtml">
- <head>
- <title>Calculating Sphere Volumes</title>
- <script type = "text/javascript">
- <!--
- function displayVolume()
- {
- var radius = parseFloat( myForm.radiusField.value );
- window.status = "Volume is " + sphereVolume( radius );
- }
- function sphereVolume( r )
- {
- return ( 4.0 / 3.0 ) * Math.PI * Math.pow( r, 3 );
- }
- // -->
- </script>
- </head>
- <body>
- <form name = "myForm" action = "">
- Enter radius of sphere<br />
- <input name = "radiusField" type = "text" />
- <input name = "calculate" type = "button" value = "Calculate"
- onclick = "displayVolume()" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement