<!DOCTYPE html>charset="utf-8"W3Cschool教程(w3cschool.cn)id="demo"单击按钮显示不同数值的自然对数。onclick="myFunction()"点我function myFunction(){var a=Math.log(2.7183);var b=Math.log(2);var c=Math.log(1);var d=Math.log(0);var e=Math.log(-1);var x=document.getElementById("demo");x.innerHTML=a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e}