1
在我的网站上,有很多页面和内容。 现在我想在网站加载时替换所有页面中的一个单词。我想在网站加载时替换所有页面中的一个词
在我的网站上,有很多页面和内容。 现在我想在网站加载时替换所有页面中的一个单词。我想在网站加载时替换所有页面中的一个词
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>
请给我一个方法,当网站加载后,功能。谢谢 –
参考[这里](http://stackoverflow.com/questions/5558613/javascript-replace-text-in-the-html-body) – Aakash