<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>innerHTML</title></head><body><h1 id="con">javascript<h1><p>xxx</p><script type="text/javascript">var mychar=document.getElementById("con");document.write("原来:"+mychar.innerHTML+"<br>");mychar.innerHTML="HELLO WORLD"document.write("现在:"mychar.innerHTML);</script></body>
1 回答
已采纳
guozhchun
TA贡献103条经验 获得超76个赞
document.write("现在:"mychar.innerHTML); // 这里错了,少了个 '+',应该是:document.write("现在:" + mychar.innerHTML);
添加回答
举报
0/150
提交
取消