fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <p>单击按钮将段落中“Microsoft”替换成“W3CSchool”:</p> <p id="demo">Visit Microsoft!</p> <button onclick="myFunction()">点我</button> <script> function myFunction(){ var str=document.getElementById("demo").innerHTML; var n=str.replace("Microsoft","W3CSchool"); document.getElementById("demo").innerHTML=n; } </script> </body> </html>
运行结果