JavaScript Tutorial/Math/PI — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:24, 26 мая 2010
Math.PI
The PI property of the Math object is used to get the constant PI.
This is approximately 3.14159.
<source lang="javascript">
<html>
<body> <script language="JavaScript"> </script> <form name=form1> The Approximate value of PI is: <input type="text" name="answer" size=20> <input type="button" value="Calculate" onClick="doMath()">
</form> </body> </html></source>
The value of the constant PI: Math.PI
<source lang="javascript">
<html> <head> <title>The Properties of the Math object</title> <script type="text/javascript" language="javascript">
</script> </head> <body onload="DisplayMath()"> </body> </html></source>
Use Math.PI to do calculation
<source lang="javascript">
<html> <head> <title>Find the area and circumference of a circle</title> <script type="text/javascript" language="javascript">
</script> </head> <body onload="FindArea()"> </body> </html></source>