Math.log() : log : Math JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Math » log »

 

Math.log()







The log() method of the Math object is used to calculate the natural logarithm (base E) of a number.












<html>
    <body>
    <script language="JavaScript">
    <!--
    function doMath(){
        var inputNum=document.form1.input.value;
        var result = Math.log(inputNum);
        document.form1.answer.value = result;
    }
    -->
    </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()'>
    <br>
    The log is:
    <input type="text" name="answer" size=10>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Math
» log