You are here: Reference > JavaScript > client-side > style handling > methods > urns (all, anchors, areas, ...)

urns method (all, anchors, areas, ...)

Browser support:
Returns a NodeList collection that contains all elements to which the specified behavior is attached.
Behaviors can be attached to elements with the behavior style property and the addBehavior method or to namespaces with the doImport method.
Perhaps for security reasons, behaviors cannot be accessed by Uniform Resource Names; therefore the urns method always returns an empty collection.

Syntax:

object.urns (URN);
You can find the related objects in the Supported by objects section below.

Parameters:

URN
Required. String that specifies the Uniform Resource Name (URN) of the behavior.

Return value:

Returns a NodeList collection that contains the matching elements.

Example HTML code 1:

This example illustrates the use of the urns method:
Code
hover.htc
<head>
    <script type="text/javascript">
        function GetElementsByBehavior () {
            var elems = document.all.urns ("hover.htc");
                // the elems.length is always zero
            alert ("There is " + elems.length + " matching element in the document.");
        }
    </script>
</head>
<body>
    <span id="mySpan" style="behavior: url('hover.htc')">
        Move the mouse over this text (element with behavior)
    </span>
    <br /><br />
    <button onclick="GetElementsByBehavior ();">Get elements by behavior</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content