天天看點

JavaScript基礎知識之——Location 對象詳解

屬性

描述

<a href="http://www.5idev.com/p-javascript_location_hash.shtml">location.hash</a>

設定或取得 URL 中的錨

<a href="http://www.5idev.com/p-javascript_location_host.shtml">location.host</a>

設定或取得 URL 中主機(包括端口号)

<a href="http://www.5idev.com/p-javascript_location_hostname.shtml">location.hostname</a>

設定或取得 URL 中的主機名

<a href="http://www.5idev.com/p-javascript_location_href.shtml">location.href</a>

設定或取得完整 URL(頁面重定向應用)

<a href="http://www.5idev.com/p-javascript_location_pathname.shtml">location.pathname</a>

設定或取得 URL 中的路徑

<a href="http://www.5idev.com/p-javascript_location_port.shtml">location.port</a>

設定或取得 URL 中的端口号

<a href="http://www.5idev.com/p-javascript_location_protocol.shtml">location.protocol</a>

設定或取得 URL 使用的協定

<a href="http://www.5idev.com/p-javascript_location_search.shtml">location.search</a>

設定或取得 URL 中的查詢字串(一般是 ? 符号後面的内容)

繼續閱讀