Document.Location Property
The Location property returns the location of the current document. The location is the full path without the file name. This property is read-only.objDoc.Location As String
Parameters
objDoc
Object expression that resolves to a Document object.
Return Values
The location of the current document.Example Code [Visual Basic]
' Retrieve the document location.
Dim strLoc As String
strLoc = objDoc.Location
MsgBox (strLoc)
Requirements
Windows NT/2000/XP: Included in Windows XP and Windows .NET Server.
Windows 95/98/Me: Unsupported.
The Location property returns the location of the current document. The location is the full path without the file name. This property is read-only.objDoc.Location As String
Parameters
objDoc
Object expression that resolves to a Document object.
Return Values
The location of the current document.Example Code [Visual Basic]
' Retrieve the document location.
Dim strLoc As String
strLoc = objDoc.Location
MsgBox (strLoc)
Requirements
Windows NT/2000/XP: Included in Windows XP and Windows .NET Server.
Windows 95/98/Me: Unsupported.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<script language="jscript">
document.writeln(document.location+"<br>");
document.writeln(window.location);
//window.document.location="http://www.163.com";
//window.location="http://www.163.com";
</script>
</body>
</html>
发现document.location和window.location返回的值一样,这是为什么?
声明了装载文档的URL,除非发生了服务器重定向,
否则该属性的值与Window.location.href的值是一样的.