Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Retrieves a collection of namespace objects.
Syntax
| JavaScript |
p = object.namespaces |
Property values
Type: IDispatch
Array of namespace objects.
Standards information
There are no standards that apply here.
Examples
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
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 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;
}
}
</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>
See also
Conceptual