gpt4 book ai didi

javascript - 我想在网站加载时替换所有页面中的一个单词

转载 作者:行者123 更新时间:2023-11-28 05:40:06 25 4
gpt4 key购买 nike

在我的网站中,有很多页面和内容。现在我想在网站加载时替换所有页面中的一个单词。

最佳答案

timer = setInterval(myFunction,100);
function myFunction() {
var str = document.getElementById("demo").innerHTML;
var res = str.replace("hello", "hi");
document.getElementById("demo").innerHTML = res;
}
<p>Click the button to replace "hello" with "hello" in the paragraph below:</p>

<p id="demo">Visit hello!</p>

关于javascript - 我想在网站加载时替换所有页面中的一个单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38995077/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com