setValue (DOMAttr - JavaScript)
Sets the value of an attribute.
Defined in
DOMAttrSyntax
setValue(value:string) : void
Parameters | Description |
---|---|
value |
A legal value for the attribute. |
Usage
This method sets a value for the attribute. Assign it to an element with setAttributeNode inDOMElement.Examples
This button creates a document with a hierarchy of elements and sets an attribute for the end node.var doc = database.createNewDocument();
var dom = doc.getDOM();
var schema0 = dom.createElement("schema0");
var element0 = dom.createElement("element0");
var attr = dom.createAttribute("Owner");
attr.setValue(session.getCommonUserName());
dom.appendChild(schema0);
schema0.appendChild(element0);
element0.setStringValue(requestScope.s);
element0.setAttributeNode(attr);
doc.save()
The XML for this document might appear as
follows:
<schema0>
<element0 Owner="wpsadmin">foo</element0>
</schema0>