figure html属性怎么应用

figure html属性怎么应用

    属性是节点(figure html元素)的值,您能够获取或设置。

    编程接口

    可通过figure html Script(以及其他编程语言)对figure html DOM进行访问。

    所有figure html元素被定义为对象,而编程接口则是对象方法和对象属性。

    方法是您能够执行的动作(比如添加或修改元素)。

    属性是您能够获取或设置的值(比如节点的名称或内容)。

    Inner figure html属性

    获取元素内容的最简单方法是使用inner figure html属性。

    innerfigure html属性对于获取或替换figure html元素的内容很有用。

    实例

    下面的代码获取id="intro"的<p>元素的inner figure html:

    实例

    <!DOCTYPE figure html>

    <figure html>

    <head>

    <metacharset="utf-8">

    </head>

    <body>

    <pid="intro">HelloWorld!</p>

    <script>

    vartxt=document.getElement ById("intro").inner figure html;

    document.write(txt);

    </script>

    </body>

    </figure html>

    尝试一下»

    在上面的例子中,get Element ById是一个方法,而inner figure html是属性。

    lamp

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

    Node Name属性规定节点的名称。

    Node Name是只读的

    元素节点的node Name与标签名相同

    属性节点的node Name与属性名相同

    文本节点的node Name始终是#text

    文档节点的node Name始终是#document

    注意:node Name始终包含figure html元素的大写字母标签名。

    Node Value属性

    Node Value属性规定节点的值。

    元素节点的node Value是unde fined或null

    文本节点的node Value是文本本身

    属性节点的node Value是属性值

    获取元素的值

    下面的例子会取回<pid="intro">标签的文本节点值:

    实例

    <!DOCTYPE figure html>

    <figure html>

    <head>

    <metach arset="utf-8">

    </head>

    <body>

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

    <script>

    x=document.getElement ById("intro");

    document.write(x.firstChild.nodeValue);

    </script>

    </body>

    </figure html>

Copyright & Disclaimer: If you find copyright issues, please provide relevant information and email us at [email protected], we will communicate promptly and handle removal.

Except for specially marked original content on abcdlink (https://www.abcdlink.com) all other content is reposted by users, and opinions/copyright are unrelated to this site.