A simple program to ask the user to give radius value and then the program will convert the given radius into area of the circle using JavaScript programming language,

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.

Program Listing
   <title>Area of the Circle in JavaScript</title>
 <style type="text/css">

 body {

 	font-family: arial;
 	font-weight: bold;
  display: inline-block;
  background-color: lightblue;
  padding: 6px;

  display: block;
  direction: rtl; 

  direction: ltr; 

  content: attr(data-text);

<script language="JavaScript">

function Solve(){

if (document.circle.radius.value === "" || document.circle.radius.value === "0" ) {
  alert("Cannot be empty. Try Again");
} else {

a = parseInt(document.circle.radius.value);

result = "The area of the circle is " + (a * a * Math.PI).toFixed(2);
document.getElementById("tag").innerHTML = result;

function Clear() {
document.circle.radius.value ="";
document.getElementById("tag").innerHTML = "";

<h3>Area of the Circle in JavaScript</h3>
<form name="circle">
<label data-text="Enter the radius of circle">&nbsp;&nbsp;
<input type="number" name="radius" autofocus required>
<span id="tag"></span>
<input type="button" value="Convert" title="Click here to solve." onclick="Solve()" />
<input type="button" value="Clear"  
title="Click here to clear the text box."

Leave a Reply

Your email address will not be published.