1、設置或獲取整個 URL 為字符串:
window.location.href
2、設置或獲取與 URL 關聯的端口號碼:
window.location.port
3、設置或獲取 URL 的協議部分
window.location.protocol
4、設置或獲取 href 屬性中跟在問號后面的部分
window.location.search
5、獲取變量的值(截取等號后面的部分)
復制代碼 代碼如下:
var url = window.location.search;
// alert(url.length);
// alert(url.lastIndexOf('='));
var loc = url.substring(url.lastIndexOf('=')+1, url.length);
新聞熱點
疑難解答
圖片精選