nsIDOMElement 编辑
dom/interfaces/core/nsIDOMElement.idl
Scriptable This interface represents an element in an HTML or XML document. Inherits from: nsIDOMNode
Last changed in Gecko 1.7Method 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
Attribute | Type | Description |
tagName | DOMString | The 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论