Export (0) Print
Expand All
0 out of 3 rated this helpful - Rate this topic

namespaces property

Retrieves a collection of namespace objects.



p = object.namespaces

Property values

Type: IDispatch

Array of namespace objects.

Standards information

There are no standards that apply here.


This sample demonstrates how to programmatically retrieve the names for all namespaces within the primary document.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/collections/namespaces.htm

<html xmlns:firstNS
<?import namespace="firstNS" implementation="some_namespace.htc">
<?import namespace="secondNS" implementation="some_namespace.htc">
<?import namespace="thirdNS" implementation="some_namespace.htc">
<script type="text/javascript">
function getNS(){
    // Retrieving the namespace's name two different ways.
    var strInfo = "The following methods demonstrate how to retrieve a "
    strInfo += "namespace's name.\n\n";
    for(x = 0; x < document.namespaces.length; x++){
        oRow = oTable.insertRow();
        //Create cell with the Index.
        oCell = oRow.insertCell();
        oCell.align = 'center';
        oCell.innerText = x;
        /* Create cell with the namespace name using
            document.namespaces.item(iIndex).name. */
        oCell = oRow.insertCell();
        oCell.align = 'center';
        oCell.innerText = document.namespaces.item(x).name;
        /* Create cell with the namespace name using
            document.namespaces(iIndex).name. */
        oCell = oRow.insertCell();
        oCell.align = 'center';
        oCell.innerText = document.namespaces(x).name;
<table id="oTable" border=1>
<button id="btn1" onclick="getNS();">Retrieve names</button>

See also

Introduction to Viewlink
About Element Behaviors



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.