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