js jquery 獲取當前頁面的url,獲取frameset中指定的頁面的url
設置或獲取整個url爲字符串:window.location.href
設置或獲取href屬性中在井號“#”後面的分段:window.location.hash
設置或獲取location 或 URL 的 hostname 和 port 號碼:window.location.host
設置或獲取href屬性中跟在問號後面的部分:window.location.search
設置或獲取對象指定的文件名或路徑:window.location.pathname
設置或獲取與URL關聯的端口號碼:window.location.port
設置或獲取 URL 的協議部分:window.location.protocol
同樣的要在frameset中獲取到指定的頁面的url也是可以的只要把window換成你指定的頁面就可以了,比如:
設置或獲取整個url爲字符串:window.parent.frames['mainFrame'].location.location.href
設置或獲取href屬性中在井號“#”後面的分段:window.parent.frames['mainFrame'].location.location.hash
設置或獲取location 或 URL 的 hostname 和 port 號碼:window.parent.frames['mainFrame'].location.location.host
設置或獲取href屬性中跟在問號後面的部分:window.parent.frames['mainFrame'].location.location.search
設置或獲取對象指定的文件名或路徑:window.parent.frames['mainFrame'].location.location.pathname
設置或獲取與URL關聯的端口號碼:window.parent.frames['mainFrame'].location.location.port
設置或獲取 URL 的協議部分:window.parent.frames['mainFrame'].location.location.protocol