为什么获取标题(h2)元素的内容是标题的内容,而获取段落(p)元素的内容是object HTMLParagraphElement?
<h2 id="con">javascript</h2> <p id="c">javascript</p> var mychar=document.getElementById("con"); var myc=document.getElementById("c"); document.write(mychar); document.write(myc);
<h2 id="con">javascript</h2> <p id="c">javascript</p> var mychar=document.getElementById("con"); var myc=document.getElementById("c"); document.write(mychar); document.write(myc);
2016-12-04
举报