I have an assigment as follows:

Create a webpage that will ask the user for a radius.

That number will be use to find the area of a circle with that radius, and then continue to calculate the next 9 circles with radii incrementing by one unit each time, and display the results to the page.

Then create a conditional statement that will limit the output to only even numbered radii.

Then a conditional statement that will limit the output to only radii divisible by 3.

And I have a code so far that looks like this:

<html>
<body>
<center>
Radius:<input type="text" name="radius" value=1><br>
<button type="button" onClick="calculate(radius.value)"> Get Next </button><br>
</center>
<script>
function calculate(rad)
{
for(var counter=0;counter<10;counter++)
{
if((rad+counter)%2==0)
{
if((rad+counter)%3==0)
{
var pie = 3.14;
document.write("(" + rad + "+" + counter + ")" + "*" + "(" + rad + "+" + counter + ")" + "*" + pie + "=");
var area = ((parseInt(rad)+counter)*(parseFloat(rad)+counter))*(pie);
document.write(area + "<br>");
}
}
}
}
</script>
</body>
</html>

So far it's not working. I'm new to scripting, and I'm having trouble understanding what's wrong.

Hoping someone could help out.

Thanks.