Retrieves a collection of namespace objects.
Syntax
[ oNamespace = ] object.namespaces[ oObject = ] object.namespaces(iIndex)
Possible Values
oNamespace Array of namespace objects.oObjectReference to an individual item in the array of elements contained by the object.iIndexRequired. Integer that specifies the zero-based index of the item to be returned.
Members Table
The following table lists the members exposed by the namespaces object.Attributes/Properties PropertyDescriptionlength Sets or retrieves the number of objects in a collection. Methods MethodDescriptionadd Creates a new namespace object and adds it to the collection.item Retrieves a namespace object from the namespaces collection. Prototypes ObjectDescriptionHTMLNamespaceInfoCollection Constructor Defines the properties and methods inherited by objects in the HTMLNamespaceInfoCollection Constructor prototype chain.
The following table lists the members exposed by the namespaces object.
Example
This sample demonstrates how to programmatically retrieve the names for all namespaces within the primary document. <HTML XMLNS:firstNS XMLNS:secondNS XMLNS:thirdNS> <HEAD> <?IMPORT NAMESPACE="firstNS" IMPLEMENTATION="some_namespace.htc"> <?IMPORT NAMESPACE="secondNS" IMPLEMENTATION="some_namespace.htc"> <?IMPORT NAMESPACE="thirdNS" IMPLEMENTATION="some_namespace.htc"> <SCRIPT> 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; } } </SCRIPT> </HEAD> <BODY> <TABLE id="oTable" BORDER=1> <TR> <TH>Index</TH> <TH>Using<BR>document.namespaces.item(iIndex).name</TH> <TH>Using<BR>document.namespaces(iIndex).name</TH> </TR> </TABLE> <BR> <BUTTON id="btn1" onclick="getNS();">Retrieve names</BUTTON> </BODY> </HTML> This feature requires Microsoft Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
This sample demonstrates how to programmatically retrieve the names for all namespaces within the primary document.
<HTML XMLNS:firstNS XMLNS:secondNS XMLNS:thirdNS> <HEAD> <?IMPORT NAMESPACE="firstNS" IMPLEMENTATION="some_namespace.htc"> <?IMPORT NAMESPACE="secondNS" IMPLEMENTATION="some_namespace.htc"> <?IMPORT NAMESPACE="thirdNS" IMPLEMENTATION="some_namespace.htc"> <SCRIPT> 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; } } </SCRIPT> </HEAD> <BODY> <TABLE id="oTable" BORDER=1> <TR> <TH>Index</TH> <TH>Using<BR>document.namespaces.item(iIndex).name</TH> <TH>Using<BR>document.namespaces(iIndex).name</TH> </TR> </TABLE> <BR> <BUTTON id="btn1" onclick="getNS();">Retrieve names</BUTTON> </BODY> </HTML>
Standards Information
There is no public standard that applies to this collection.
Applies To
document, HTMLDocument Constructor
See Also
Introduction to Viewlink, About Element Behaviors