<!DOCTYPE?html>
<html>
<head>
<meta?charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul>
<li>11</li>
<li>22</li>
<li>33</li>
<li>44</li>
<li>55</li>
<li>66</li>
</ul>
<script>
var?oUl?=?document.getElementsByTagName("ul")[0];
var?newNode?=?document.createElement("li");
var?xxnode?=document.getElementsByTagName("li");
newNode.innerHTML?=?"hello?world!";
oUl.insertBefore(newNode,xxnode[0]);
</script>
</body>
</html>我想問的是,這個方法第二個參數(shù)索引的時候,不算空白節(jié)點么? 我發(fā)現(xiàn)直接按正常的0,1,2,3去取值就可以。這是為什么
insertBefore()方法第二個參數(shù)的問題
abc123456789def
2017-05-06 20:45:59