题目

我的作业地址:
https://github.com/MJingv/baiduFE--jsproject/blob/master/task4.html
可以用2种方式思考:
1.dom操作(appendchild,insertbefore,removechild)
2.数组操作(shift,unshift,push,pop)
因为数组要从新加载整个数组,所以我才用第一种方法
和以前一样,添加节点方法:
a.createElement
b.赋值innerText
c.appendChild
removechild只要获得节点即可
insertbofore第二个参数是插入的位置,头就是children【0】
有一点很生气啊,childnodes的兼容性很差
而且莫名其妙会有空白节点,据说body什么的它会自动插入,
所以乖乖的用children吧

网友评论