Answer to Question #286319 in HTML/JavaScript Web Application for rushi

Question #286319

Write a function area that calculates the area of a circle. The function is given the radius of the circle.


1
Expert's answer
2022-01-10T07:38:03-0500
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <body>
        <script language="JavaScript">
          function CircleArea(){
              var radius =document.form1.foo.value;
              document.write("<p>The area " + (radius * radius * Math.PI) + "</p>");
              document.write("<p>The Circumference " + (2 * radius * Math.PI) + "</p>");
          }
          </script>
          <form name=form1>
              Enter the radius of circle:
             <input type="text" name="foo" size=10>
             <br>
             <input type="button" value="Calculate" onClick='CircleArea();'>  
          </form>
      </script>
      </body>
</body>
</html>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS