在我的网站上,有很多页面和内容。现在我想要替换所有网页中的一个词,当网站加载。
发布于 2016-08-17 19:20:04
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>
https://stackoverflow.com/questions/38995077
复制相似问题