2016-08-17 1 views
1

私のウェブサイトには、多くのページとコンテンツがあります。 今、私は、ウェブサイトが読み込まれたときに、すべてのページから1つの単語を置き換えたいと思います。ウェブサイトがロードされたときに、すべてのページから1語を置き換えたい

+2

私に道を教えてください[この](http://stackoverflow.com/questions/5558613/javascript-replace-text-in-the-html-body) – Aakash

答えて

0

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>

+0

を参照してください。 、ウェブサイトがロードされた後、機能します。ありがとう –

関連する問題