August 1999
Intermediate to advanced
1488 pages
72h 53m
English
math.SQRT1_2The SQRT1_2 property of the Math object returns the square root of one half, which is approximately 0.707.
Listing 6.174 shows how SQRT1_2 can be used. The function, doMath, returns the square root of 1/2 to the text box on the page.
<html> <body> <script language="JavaScript"> <!–– Hide // function returns the square root of 1/2 function doMath(){ var result = Math.SQRT1_2; document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> The square root of 1/2 is: <input type="text" name="answer" size=20> <input type="button" value="Calculate" ... |
Read now
Unlock full access