运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript String Methods</h1> <p>Replace "Microsoft" with "W3Schools" in the paragraph below:</p> <button onclick="myFunction()">Try it</button> <p id="demo">Please visit Microsoft!</p> <script> function myFunction() { let text = document.getElementById("demo").innerHTML; document.getElementById("demo").innerHTML = text.replace(/MICROSOFT/i,"W3Schools"); } </script> </body> </html>