天天看點

javascript的location/history

< DOCTYPE html PUBLIC -WCDTD XHTML TransitionalEN httpwwwworgTRxhtmlDTDxhtml-transitionaldtd>

Location.href 傳回整個目前url,若對其指派:

lcation.hostname 傳回域名

location.port 傳回端口

location.pathname 傳回域名後第一個斜框後的字元串

location.hash 跳到本頁的某個錨

location.search 取url?後的部分

javascript 的history對象

history.back() 等同于按浏覽器的後退按鈕

history.forward() 等同于按浏覽器的前進按鈕

history.current 指目前的url(等同于location.href),

在曆史中的索引位置總為 0

history.go(-2)或 history.go("任意.html") 向前或向後移動,

或查找字元串标明的最新url

本文轉自 netcorner 部落格園部落格,原文連結:http://www.cnblogs.com/netcorner/archive/2007/12/17/2912242.html  ,如需轉載請自行聯系原作者

繼續閱讀