most of the methods for working with attributes come from ixmldomelement. attributes can be manipulated in the following ways.
directly, through the getattribute and setattribute methods of ixmldomelement.
as named ixmldomattribute nodes, with getattributenode and setattributenode.
as a set of nodes accessible through the attributes property and returned as an ixmlnamednodemap.
examples
jscript
the following jscript example creates a new document containing a <memo> element, and then creates an attribute named author with a value of "pat coleman".
vbscript
if you prefer to work with attribute nodes, you can create the attribute, and then create a text node to store its value. attribute nodes can only contain text nodes and entity reference nodes. (if you need to create an attribute containing an entity reference, you must use this approach.)
working with attribute nodes requires using the domdocument object to create attribute and text (and entity reference, if necessary) nodes before assigning the nodes to the element.
jscript
the following jscript code uses this approach to perform the same work as the preceding examples, creating a <memo> element with an author attribute holding the value "pat coleman".
vbscript
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论