1
<p id="demo">单击按钮获取li元素的根文字的节点类型</p>
2
<button onclick="myFunction()">点我</button>
3
<script>
4
function myFunction() {
5
var x = document.getElementById("demo");
6
x.innerHTML = x.ownerDocument.nodeType;
7
}
8
</script>
<p id="demo">单击按钮获取li元素的根文字的节点类型</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction() {
var x = document.getElementById("demo");
x.innerHTML = x.ownerDocument.nodeType;
}
</script>