You are here: Reference > JavaScript > client-side > xml handling > properties > nodeTypedValue (attribute, Element)

nodeTypedValue property (attribute, Element)

Browser support:
Sets or returns the value of the node in its data type. The data type of a node can be defined with the dataType property.

Syntax:

object.nodeTypedValue;
You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

The value of the current node in its defined data type.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the nodeTypedValue property:
Code
ajax.js
<head>
    <script type="text/javascript" src="ajax.js"></script>
    
    <script type="text/javascript">
        function TestDataTypesAndValues () {
                // create an XML document
            var xmlDoc = CreateXMLDocumentObject ("root");  // defined in ajax.js
            if (!xmlDoc) {
                return null;
            }

            var root = xmlDoc.documentElement;

                // add two elements to the document with different data types
            var sizeNode = xmlDoc.createElement ("size");
            sizeNode.dataType = "int";
            sizeNode.nodeTypedValue = 120;
            root.appendChild (sizeNode);

            var colorNode = xmlDoc.createElement ("color");
            colorNode.dataType = "string";
            colorNode.nodeTypedValue = "red";
            root.appendChild (colorNode);

                // get the data type and value of the elements
            var sizeNode = root.getElementsByTagName ("size")[0];
            alert ("The data type and value of the size element:\n" + 
                    sizeNode.dataType + ", " + sizeNode.nodeTypedValue);

            var colorNode = root.getElementsByTagName ("color")[0];
            alert ("The data type and value of the color element:\n" + 
                    colorNode.dataType + ", " + colorNode.nodeTypedValue);

                // display the source of the XML
            alert ("The source of the XML:\n" + root.xml);
        }
    </script>
</head>
<body>
    <button onclick="TestDataTypesAndValues ();">Test data types and values</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content