【问题标题】:I want to replace one word from all page when website is loaded [duplicate]加载网站时,我想替换所有页面中的一个单词[重复]
【发布时间】:2016-08-17 11:14:49
【问题描述】:

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

【问题讨论】:

标签: javascript replace web words loaded


【解决方案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>

【讨论】:

  • 请给我一个方法,当网站被加载然后功能。谢谢
猜你喜欢
  • 2019-09-13
  • 2021-09-27
  • 2021-05-05
  • 2015-07-09
  • 1970-01-01
  • 2013-03-21
  • 1970-01-01
  • 1970-01-01
  • 2014-05-19
相关资源
最近更新 更多