Mega Code Archive

 
Categories / JavaScript Tutorial / Math
 

Math acos()

Syntax math.acos(num) The acos() method calculates the arccosine of a number. The return value is between 0 and PI and is measured in radians. If the return value is outside this range, 0 is returned. <html>     <body>     <script language="JavaScript">     <!--     function doMath(){         var inputNum=document.form1.input.value;         var result = Math.acos(inputNum);         document.form1.answer.value = result;     }     -->     </script>     <form name=form1>     This example calculates the arccosine of the number entered.     <br><br>     Enter Number:     <input type="text" name="input" size=10>     <input type="button" value="Calculate" onClick='doMath()'>     <br>     The arccosine is:     <input type="text" name="answer" size=10>     </form>     </body>     </html>