nsIDOMElement 编辑

dom/interfaces/core/nsIDOMElement.idlScriptable This interface represents an element in an HTML or XML document. Inherits from: nsIDOMNode Last changed in Gecko 1.7

Method overview

DOMString getAttribute(in DOMString name);
nsIDOMAttr getAttributeNode(in DOMString name);
nsIDOMAttr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);
DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);
nsIDOMNodeList getElementsByTagName(in DOMString name);
nsIDOMNodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName);
boolean hasAttribute(in DOMString name);
boolean hasAttributeNS(in DOMString namespaceURI, in DOMString localName);
void removeAttribute(in DOMString name)
nsIDOMAttr removeAttributeNode(in nsIDOMAttr oldAttr)
void removeAttributeNS(in DOMString namespaceURI, in DOMString localName)
void setAttribute(in DOMString name, in DOMString value)
nsIDOMAttr setAttributeNode(in nsIDOMAttr newAttr)
nsIDOMAttr setAttributeNodeNS(in nsIDOMAttr newAttr)
void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value)

Attributes

AttributeTypeDescription
tagNameDOMStringThe element tag name. Read only.

Methods

getAttribute()

Get an attribute value.

DOMString getAttribute(
  in DOMString name
);
Parameters
name
Attribute name
Return value

A DOMString containing the attribute value.

getAttributeNode()

Get an attribute node.

nsIDOMAttr getAttributeNode(
  in DOMString name
);
Parameters
name
Attribute name
Return value

A nsIDOMAttr corresponding to the attribute.

getAttributeNodeNS()

Get an attribute node in a given namespace.

nsIDOMAttr getAttributeNodeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Attribute name
Return value

A nsIDOMAttr corresponding to the attribute.

getAttributeNS()

Get an attribute value in a given namespace.

DOMString getAttributeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Attribute name
Return value

A DOMString containing the attribute value.

getElementsByTagName()

Get all descendants of a tag name.

nsIDOMNodeList getElementsByTagName(
  in DOMString name
);
Parameters
name
Tag name
Return value

A nsIDOMNodeList containg all the descendants of this tag name.

getElementsByTagNameNS()

Get all descendants of a tag name in a given namespace.

nsIDOMNodeList getElementsByTagNameNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Tag name
Return value

A nsIDOMNodeList containg all the descendants of this tag name.

hasAttribute()

Check if the element have this attribute set.

boolean hasAttribute(
  in DOMString name
);
Parameters
name
Attribute name
Return value

A boolean, true if the given attribute is set.

hasAttributeNS()

Check if the element for a given namespace have this attribute set.

boolean hasAttributeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Attribute name
Return value

A boolean, true if the given attribute is set.

removeAttribute()

Remove an attribute.

void removeAttribute(
  in DOMString name
);
Parameters
name
Attribute name

removeAttributeNode()

Remove an attribute, giving the attribute node.

nsIDOMAttr removeAttributeNode(
  in nsIDOMAttr oldAttr
);
Parameters
oldAttr
Attribute node to remove
Return value

A nsIDOMAttr corresponding to the removed attribute node.

removeAttributeNS()

Remove an attribute.

void removeAttributeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Tag name

setAttribute()

Set an attribute.

void setAttribute(
  in DOMString name,
  in DOMString value
);
Parameters
name
Attribute name
value
Attribute new value

setAttributeNode()

Set an attribute, giving the attribute node.

nsIDOMAttr setAttributeNode(
  in nsIDOMAttr newAttr
);
Parameters
newAttr
Attribute node.
Return value

A nsIDOMAttr corresponding to the attribute node added.

setAttributeNodeNS()

Set an attribute, giving the attribute node.

nsIDOMAttr setAttributeNodeNS(
  in nsIDOMAttr newAttr
);
Parameters
newAttr
Attribute node.
Return value

A nsIDOMAttr corresponding to the attribute node added.

setAttributeNS()

Set an attribute.

void setAttributeNS(
  in DOMString namespaceURI,
  in DOMString qualifiedName,
  in DOMString value
);
Parameters
namespaceURI
Namespace URI
qualifiedName
Attribute name
value
Attribute new value

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:72 次

字数:11381

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文