Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Find the area and circumference of a circle</title>
- </head>
- <body>
- <script language="JavaScript">
- function CalculateArea(){
- var sol = document.getElementById("solution");
- var radius =document.form1.txtRadius.value;
- sol.innerHTML += "<P>The area of the circle is " + (radius * radius * Math.PI) + "</p>";
- sol.innerHTML+="<P>The circumference of the circle is " + (2 * radius * Math.PI) + "</p>";
- }
- </script>
- <form name=form1>
- Enter the radius of circle:
- <input type="text" name="txtRadius" size=10>
- <br>
- <input type="button" value="Calculate" onClick='CalculateArea();'>
- </form>
- <div id="solution"></div>
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment