August 1999
Intermediate to advanced
1488 pages
72h 53m
English
math.log(num)
The log() method of the Math object is used to calculate the natural logarithm (base E) of a number.
Listing 6.163 shows how the log() method is used.
<html> <body> <script language="JavaScript"> <!–– Hide function doMath(){ var inputNum=document.form1.input.value; var result = Math.log(inputNum); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> This example calculates the natural log of the number entered. <br><br> Enter First Number: <input type="text" name="input" size=15> <input type="button" value="Calculate" onClick='doMath()'> ... |
Read now
Unlock full access