2016-08-17 86 views

回答

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

请给我一个方法,当网站加载后,功能。谢谢 –

相关问题