zoukankan      html  css  js  c++  java
  • 《JavaScript DOM编程艺术》附录(dom方法和属性)

    本附录内容:

    (1)创建节点:

          reference = document.createElement(element)

          reference = document.createTextNode(text)

    (2)复制节点:

          reference = node.cloneNode(deep)

    (3)插入节点

          reference = element.appendChild(newChild)

          reference = element.insertBefore(newNode,tagetNode)

    (4)删除节点

           reference = document.removeChild(node)      

    (5)替换节点

          reference = element.replaceChild(newChild,oldChild)

    (6)处理节点

          element.setAttribute(attributeName,attributeValue)

    (7)查找节点

          attributeValue = element.getAttribute(attributeName)

          element = document.getElementById(Id)

          elements = document.getElementsByTagName(tagName)

          booleanValue = element.hasChildNodes

    (8)节点属性

           name = node.nodeName

           value = node.nodeValue

    (9)遍历节点树

          nodeList = node.childNodes

          node.childNodes.length

          reference = node.firstChild

          reference = node.lastChild

          reference = node.nextSibling

          reference = node.parentNode

          reference = node.previousSibling 属性返回一个给定节点的前一个子节点;只读属性     

  • 相关阅读:
    Linux socket编程 服务器 客户端
    嵌入式编程 相关 细节 收集
    Linux内核运行机制学习笔记
    Button驱动学习
    LED驱动学习
    C#修改IIS匿名账号的密码问题
    数据库自增字段的获取
    VC头文件的顺序 以及一些常见错误的常见处理方式
    WIN8 更新CD KEY
    linux下 lvm 磁盘扩容
  • 原文地址:https://www.cnblogs.com/chinaniit/p/1432786.html
Copyright © 2011-2022 走看看