<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>替换文字</title> <script> function dianwo(){ var div1 = document.getElementById("div1"); div1.innerHTML="<font color='green'>大家好</font>"; var div2 = document.getElementById("div2 " ); div2.innerText = " Hello everybody " ; } </ Script > </ head > < body > < the INPUT of the type =" the Button " value =" point me " onclick =" dianwo () " /> < div the above mentioned id = "div1" > click the button I will be replaced </ div > < div the above mentioned id = "div2" > click the button and I will be replaced with </div> </body> </html>