zoukankan      html  css  js  c++  java
  • DOM

    DOM(Document Object Model)文档对象模型

    四个非常重要的DOM方法:getElementById、getElementByTagName、getAttribute、setAttribute。

    通过getElementById、getElementByTagName检索特定元素节点。

    1.getAttribute()方法

    getAttribute()是一个函数,它只有一个参数,你打算查询的属性名字。

    object.getAttribute(attribute)    此object一个元素的节点。

    if(something)与  if(something!=null)完全等价。

    2.setAttribute()方法

    setAttribute()方法通过元素节点对象调用的函数。需要传递两个参数。

    setAttribute(attribute,value)

    DOM还提供了其他属性和方法,如:nodeName、nodeValue、childeNodes。nextSibling和parentNode等

  • 相关阅读:
    Login
    2Sum,3Sum,4Sum,kSum,3Sum Closest系列
    Word Search II
    Word Search
    Linux命令四
    linux命令三
    Linux命令二
    Linux命令一
    网络基础
    操作系统
  • 原文地址:https://www.cnblogs.com/Eleanore/p/2518174.html
Copyright © 2011-2022 走看看