编辑下面的代码:【加编码】
<html> <body> <p id="demo">Click the button to display the square root of different numbers.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var a=Math.sqrt(0); var b=Math.sqrt(1); var c=Math.sqrt(9); var d=Math.sqrt(64); var e=Math.sqrt(-9); var x=document.getElementById("demo") x.innerHTML=a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂