【发布时间】:2016-08-17 11:14:49
【问题描述】:
在我的网站中,有很多页面和内容。 现在我想在加载网站时替换所有页面中的一个单词。
【问题讨论】:
-
参考this
标签: javascript replace web words loaded
在我的网站中,有很多页面和内容。 现在我想在加载网站时替换所有页面中的一个单词。
【问题讨论】:
标签: javascript replace web words loaded
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>
【讨论】: