zoukankan      html  css  js  c++  java
  • document、element、node方法

    document方法:
    • getElementById(id)返回指定结点的引用
    • getElementsByTagName(name) 返回文档中所有匹配的元素的集合
    • createElement(name)创建指定类型的新结点
    • createTextNode(text)创建一个纯文本结点
    element方法:
    • getAttribute(id)返回指定属性的值
    • setAttribute(id,value)给属性赋值
    • removeAttribute(id)移除指定属性和它的值
    • getElementsByTagName(name)
    node方法:
    • appendChild(child)给指定结点添加一个新的子结点
    • removeChild(child)移除指定结点的子结点
    • replaceChild(newChild,oldChild) 替换指定结点的子结点
    • insertBefore(newChild,refChild) 在同一层级的结点前面插入新结点
    • hasChildNodes()如果结点有子结点则返回true
    node属性:
    • nodeName以字符串的格式存放结点的名称
    • nodeType以整型数据格式存放结点的类型
    • nodeValue以可用的格式存放结点的值
    • parentNode指向结点的父结点的引用
    • childNodes指向子结点的引用的集合
    • firstChild指向子结点结合中的第一个子结点的引用
    • lastChild指向子结点结合中的最后一个子结点的引用
  • 相关阅读:
    hdu1754:I Hate It
    hdu1166
    bzoj1642:挤奶时间
    线段树
    bzoj1699:排队
    bzoj3438: 小M的作物
    bzoj2127: happiness
    bzoj2768[JLOI2010]冠军调查
    bzoj1070[SCOI2007]修车
    bzoj1305[CQOI2009]dance跳舞
  • 原文地址:https://www.cnblogs.com/netwenchao/p/1662621.html
Copyright © 2011-2022 走看看