案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body><p id="demo">点击按钮来获得 body 元素首个子节点的名称。</p>
4
5
<button onclick="myFunction()">试一下</button>
6
7
<script>
8
function myFunction()
9
{
10
var x=document.getElementById("demo");  
11
x.innerHTML=document.body.childNodes.item(0).nodeName;
12
}
13
</script>
14
15
</body>
16
</html>
17