看不懂這個長度
var x=document.getElementById("con"); document.write(x.firstChild.length); ?document.write(x.lastChild.length); 看不懂為什么是 3 1
var x=document.getElementById("con"); document.write(x.firstChild.length); ?document.write(x.lastChild.length); 看不懂為什么是 3 1
2016-07-24
舉報
2016-07-24
前面HTML要這么挨著寫
div與p標簽之間有空格和換行的話firstChild就會選到空格,有幾個空格length就是幾;如果去掉空格選到P的話結果應該是undefined。