美文网首页
DOM方法、二维数组

DOM方法、二维数组

作者: Simon_s | 来源:发表于2016-10-10 20:38 被阅读33次

1、DOM方法:

getElementById()
getElementByTagName()
getElementByName()
getElementByClassName()

createElement()         创建一个对象
父元素.appendChild(节点) 在父元素结尾处添加一个子节点
父元素.insertBefore(新节点,目标节点)在目标节点之前插入新节点
父元素.replaceChild(新节点,旧节点)用新节点替换旧节点
节点.cloneNode(true)      复制
父元素.removeChild(节点) 删除一个子节点

getAttribute("属性名")         获取属性值
setAttribute("属性名","属性值")   赋值

2、二维数组的声明与遍历:

var arr = new Array(new Array(1,2,3),new Array("sds","sds","sds"))
var arr = [[1,2,3],[23,23],[23,21,33]]

相关文章

网友评论

      本文标题:DOM方法、二维数组

      本文链接:https://www.haomeiwen.com/subject/onsvyttx.html