Click to See Complete Forum and Search --> : math stuff


bob_and_charlie
07-19-2003, 11:56 AM
:confused: I am trying out a script to get the area of the circle but the script is not having it. script follows:

<script type="text/javascript">
function area()
{
rad=document.form2.radius.value;
rt=document.form2.pi.value;
c=document.form2.area.value;
d=eval(Math.pow(rad,2))
{
c = eval(rt*d);
}
}
</script>

Is my script right... please help!!

David Harrison
07-19-2003, 12:14 PM
This should work, although I could remember what the js for pi is so I just found it on the calculator and pasted it in.

I think the maths way is:

x * Sin(180/x)

where x is very large.

Nevermind all that though, try the script and see if it does what you want.