js獲取地址欄中的數據


window.location.href:設置或獲取整個 URL 為字符串
window.location.pathname:設置或獲取對象指定的文件名或路徑
window.location.search:設置或獲取 href 屬性中跟在問號后面的部分
要獲取變量的值可以試試:
var urlParam= window.location.search;
var loc = urlParam.substring(urlParam.lastIndexOf('=')+1, urlParam.length);
如果是多個參數可以分布切割,得到多個鍵值對。
參考文章鏈接:https://blog.csdn.net/gotofind/article/details/78961694


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM