Please visit our sponsors !
DOM - The Element object
Take a look at the XML file used in the examples: note.xml
Examples
tagName
How to return the tag name of a node.
getElementsByTagName
How to return the value of a specified node.
getAttribute
How to return an attribute's value.
setAttribute
How to change an attribute's value.
setAttribute 2
How to set a new attribute and its value.
The Element object
The element object represents the element nodes in the document. If the
element node contains text, this text is represented in a text node. The
properties and methods of the Element
object are listed below:
W3C Properties
Property |
Description |
tagName |
Returns, or sets the name of the node |
W3C Methods
Method |
Description |
getAttribute(attributeName) |
Returns the value of the specified attribute |
getAttributeNode(attributeName) |
Returns the specified attribute node as an object |
getElementsByTagName(tagName) |
Returns the specified node, and all its child nodes, as a
nodeList |
normalize() |
Puts the text nodes for this element, and its child nodes,
into one text node, returns nothing |
removeAttribute(attributeName) |
Removes the specified attribute's value. If the attribute
has a default value this value is inserted |
removeAttributeNode(attributeNode) |
Removes the specified attribute node. If the attribute node
has a default value, this attribute is inserted |
setAttribute(attributeName, attributeValue) |
Inserts a new attribute |
setAttributeNode(attributeNodeName) |
Inserts a new attribute node |
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|