Calculate the arccosine of a number in JavaScript

Description

The following code shows how to calculate the arccosine of a number.

Example


<html>
<body>
  <script language="JavaScript">
    function doMath() {<!--from  w  ww  .  j  a  v a  2s .  com-->
      var inputNum = document.form1.input.value;
      var result = Math.acos(inputNum);
      document.form1.answer.value = result;
    }
  </script>
  <form name=form1>
    <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>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window