Sets an attribute to the node.
setAttribute(attName, attValue);
Parameter |
Description |
attName |
the attribute name (string) |
attValue |
the attribute value (string) |
Return Value
If the method succeeds, the return value is true. If the method fails, the return value is false. SGWorld.lastError contains the failure reason.
Remarks
This method allows the user to set attributes to nodes.
The attribute name/value must follow the rules of the XML attribute name/value.
Example
The following example illustrates the use of the setAttribute method.
function setAttributeToRoot()
{
globe.root.setAttribute("MyAtt1","123.0");
var myVal = globe.root.getAttribute("MyAtt1");
alert("The value of 'MyAtt1' is: " + myVal);
}