You are here: Reference > JavaScript > client-side > style handling > objects > behaviorUrns

behaviorUrns collection

Browser support:
Represents a collection of the Uniform Resource Names for all behaviors attached to an element.
Perhaps for security reasons, the elements of the behaviorUrns collection are always empty strings. The only information provided by the behaviorUrns collection is the number of attached behaviors (length property).

Syntax:

Properties that reference the object:
object.behaviorUrns

Possible members:

Properties:
length
Returns an integer that specifies the number of behaviors in the current collection.

This property is read-only.
Methods:
[index]
Returns a Uniform Resource Name from the current collection by index.

Parameters:

index
Required. Zero-based integer that specifies the position of the behavior to retrieve.

Return value:

Returns a string that contains the Uniform Resource Name. Perhaps for security reasons, always returns an empty string.
item (index)
Returns a Uniform Resource Name from the current collection by index.

Parameters:

index
Required. Zero-based integer that specifies the position of the behavior to retrieve.

Return value:

Returns a string that contains the Uniform Resource Name. Perhaps for security reasons, always returns an empty string.

Example HTML code 1:

This example illustrates the use of the behaviorUrns collection:
Code
hover.htc
<head>
    <style>
        #myDiv {
            behavior: url(hover.htc);
        }
    </style>
    <script type="text/javascript">
        function GetURNs () {
            var div = document.getElementById ("myDiv");

            if ('behaviorUrns' in div) {
                alert ("The number of attached behaviors is " + div.behaviorUrns.length);
            }
            else {
                alert ("Your browser doesn't support the behaviorUrns property!");
            }
        }
    </script> 
</head>
<body>
    <div id="myDiv">Sample division</div>
    <br />
    <button onclick="GetURNs ();">Get the behaviors attached to the 'Sample division' element!</button>
</body>
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content