zoukankan      html  css  js  c++  java
  • js---html dom

    1:<p id="id1">abc</p>

    var x=document.getElementById("id1");

    document.write("<p>note是:"+x.innerHTML+"</p>");

    在上面的3行代码中,getElementById 是一个方法,而 innerHTML 是属性。

    innerHTML 属性可用于获取或改变任意 HTML 元素,包括 <html> 和 <body>。

    还有类似方法:

    2:nodeValue:属性规定节点的值

    nodeName:属性规定节点的名称,是只读的。

    <p id="intro">Hello World!</p>

    x=document.getElementById("intro");
    document.write(x.firstChild.nodeValue);

    3:除此之外,还有很多

  • 相关阅读:
    国王游戏
    选数
    双塔
    线段树
    树状数组及其他特别简单的扩展
    折半搜索
    VUE项目
    git_基本使用
    同源
    axios-使用
  • 原文地址:https://www.cnblogs.com/m-xy/p/3420920.html
Copyright © 2011-2022 走看看