為什么輸出X.innerHTML全是undefined?
for(var i=content.childNodes.length-1;i>0;i--){
? ? ? /*if(content.childNodes[i].nodeType!=1){ ??
? ? ? ? ?continue; ?
? ? ? }else{*/
? ? ? ? ?var x=content.removeChild(content.childNodes[i]); ? ?
? ? // }
? ? ? ? ?document.write(x.innerHTML);
? ? ? }
把注釋部分還原就又可以了。這是為什么?
2016-03-25
一些節(jié)點是沒有HTML屬性的就是你if...else..篩選出的nodeType=1的部分