[http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_location.asp]: ___________________________________________________________________ Property | Description --------------------------------------------------------------- hash | Sets or retrieves the subsection of the href property that follows the number sign (#). --------------------------------------------------------------- host | Sets or retrieves the hostname and port number of the location or URL. ---------------------------------------------------------------- hostname | Sets or retrieves the host name part of the location or URL. ---------------------------------------------------------------- href | Sets or retrieves the entire URL as a string. ---------------------------------------------------------------- pathname | Sets or retrieves the file name or path specified by the object. ---------------------------------------------------------------- port | Sets or retrieves the port number associated with a URL. ---------------------------------------------------------------- protocol | Sets or retrieves the protocol portion of a URL. ---------------------------------------------------------------- search | Sets or retrieves the substring of the href property that follows the question . ----------------------------------------------------------------
分数不够再给
document.write("以下列出document.location的所有属性<br>")
for(a in document.location)
document.write(a + "<br>")
document.write("更详细的参见http://www.msdn.com")
</script>运行以上代码看看
document.location也是正确的,它返回文档的location对象
___________________________________________________________________
Property | Description
---------------------------------------------------------------
hash | Sets or retrieves the subsection of the href property that follows the number sign (#).
---------------------------------------------------------------
host | Sets or retrieves the hostname and port number of the location or URL.
----------------------------------------------------------------
hostname | Sets or retrieves the host name part of the location or URL.
----------------------------------------------------------------
href | Sets or retrieves the entire URL as a string.
----------------------------------------------------------------
pathname | Sets or retrieves the file name or path specified by the object.
----------------------------------------------------------------
port | Sets or retrieves the port number associated with a URL.
----------------------------------------------------------------
protocol | Sets or retrieves the protocol portion of a URL.
----------------------------------------------------------------
search | Sets or retrieves the substring of the href property that follows the question .
----------------------------------------------------------------