编辑下面的代码:【加编码】
<html> <body> <p>Given that x=10 and y=5, calculate x-=y, and display the result.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x=10; var y=5; x-=y; var demoP=document.getElementById("demo") demoP.innerHTML="x=" + x; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂