DOMElement methods

In addition to the methods it inherits from the DOMNode interface, the DOMElement interface supports the following methods:

getAttribute(strAttrName) 
Returns  String 
Description  Returns the value of the element's strAttrName attribute. 
Usage 
JScript  DOMElement_object.getAttribute("strAttrName");  
VBScript  DOMElement_object.getAttribute("strAttrName") 
Example 
// SoftQuad Script Language JSCRIPT:
var tag=ActiveDocument.documentElement;
Application.Alert(tag.getAttribute("Id"));
 

getAttributeNode(strAttrName) 
Returns  DOMAttr 
Description  Returns a DOMAttr node corresponding to the attribute strAttrName
Usage 
JScript  DOMElement_object.getAttributeNode("strAttrName");  
VBScript  DOMElement_object.getAttributeNode("strAttrName") 
Example 
// SoftQuad Script Language JSCRIPT:
var tag=ActiveDocument.documentElement;
var attr = tag.getAttributeNode("Id");
 

getElementsByTagName(strTagName) 
Returns  DOMNodeList 
Description  Returns an DOMNodeList of DOMElement objects, representing all the subelements named strTagName contained in this element. The special strTagName value `*' matches all elements. 
Usage 
JScript  DOMElement_object.getElementsByTagName("strTagName");  
VBScript  DOMElement_object.getElementsByTagName("strTagName") 
Example 
// SoftQuad Script Language JSCRIPT:
var tag=ActiveDocument.documentElement;
var nodelist = tag.getElementsByTagName("*");
Application.Alert(nodelist.length);
 

normalize 
Returns  No return value 
Description  Puts all DOMText nodes in the full depth of the sub-tree underneath the DOMElement into a `normal' form where only markup (elements, comments, processing instructions, sections, and entity references) separates DOMText nodes. No action occurs for this method. 
Usage 
JScript  DOMElement_object.normalize();  
VBScript  DOMElement_object.normalize 

removeAttribute(strAttrName) 
Returns  No return value 
Description  Removes the attribute specified by strAttrName from the element. Not implemented. 
Usage 
JScript  DOMElement_object.removeAttribute("strAttrName");  
VBScript  DOMElement_object.removeAttribute "strAttrName" 

removeAttributeNode(nodeDOMAttr) 
Returns  DOMAttr 
Description  Removes a DOMAttr node from the element. This DOMAttr node is returned. Not implemented. 
Usage 
JScript  DOMElement_object.removeAttributeNode(nodeDOMAttr);  
VBScript  DOMElement_object.removeAttributeNode nodeDOMAttr 

setAttribute(strAttrName, strAttrValue) 
Returns  No return value 
Description  Creates an strAttrName attribute for the element, with the value strAttrValue. Not implemented; use Selection.ContainerAttribute or Selection.ElementAttribute
Usage 
JScript  DOMElement_object.setAttribute("strAttrName", "strAttrValue");  
VBScript  DOMElement_object.setAttribute "strAttrName", "strAttrValue" 

setAttributeNode(DOMAttr) 
Returns  DOMAttr 
Description  Adds the attribute node DOMAttr to the element. Not implemented. 
Usage 
JScript  DOMElement_object.setAttributeNode(Attr);  
VBScript  DOMElement_object.setAttributeNode(Attr) 


Right arrow
Next Topic
Left arrow
Previous Topic
Table of contents
Table of Contents

Copyright © SoftQuad Software Inc. 1999