<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>无标题文档</title></head><body><div id="con"> <p>javascript</p> <div>jQuery</div> <h5>PHP</h5></div><script type="text/javascript"> var x=document.getElementById("con"); document.write("第一"+x.firstChild.innerHTML+"<br>"+"元素节点名:"+x.firstChild.nodeName+"<br>"+"节点的值:"+x.firstChild.nodeValue+"<br>"+"节点类型:"+x.firstChild.nodeType+"<br><br>"); document.write("最后一个"+x.lastChild+"<br>"+"元素节点名:"+x.lastChild.nodeName+"<br>"+"节点的值:"+x.lastChild.nodeValue+"<br>"+"节点类型:"+x.lastChild.nodeType+"<br><br>");</script></body></html>
添加回答
举报
0/150
提交
取消