window.location.search实现页面跳转传参
2017-09-27 16:08
429 查看
window.location.search 是用来获取地址栏url的参数
先来普及一下window.location 对象所包含的属性
属性 描述
hash 从 “#” 开始的url
host 主机名和当前url的端口号
hostname 当前url 的主机名
href 完整的url
pathname 当前url的路径部分
port 当前url的端口号
protocol 当前url的协议
search 从 “?” 开始的url(查询部分)
今天本人遇到一个业务需求,就是从首页跳到个人中心,并且根据点击的项激活个人中心的对应项
点击首页 跳到个人中心页 对应的项被激活
index.html :
usercenter.js :
这样就解决了两个页面之间传参的问题
先来普及一下window.location 对象所包含的属性
属性 描述
hash 从 “#” 开始的url
host 主机名和当前url的端口号
hostname 当前url 的主机名
href 完整的url
pathname 当前url的路径部分
port 当前url的端口号
protocol 当前url的协议
search 从 “?” 开始的url(查询部分)
今天本人遇到一个业务需求,就是从首页跳到个人中心,并且根据点击的项激活个人中心的对应项
点击首页 跳到个人中心页 对应的项被激活
index.html :
usercenter.js :
这样就解决了两个页面之间传参的问题
相关文章推荐
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- window.location.reload();页面实现跳转和刷新
- ASP.Net中使用 window.location.href 实现页面跳转(转自:永恒的回忆)
- js函数在window.location.href跳转页面传参由于空格引发的一个小问题
- window.location.reload();页面实现跳转和刷新
- js 中实现页面跳转的方法(window.location和window.open的区别)
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- window.location.href跳转页面,问号传参并将参数转为json对象
- 用window.location.href实现页面跳转
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- window.location.reload();页面实现跳转和刷新
- window.location.reload();页面实现跳转和刷新
- ASP.Net中使用 window.location.href 实现页面跳转
- window.location.reload();页面实现跳转和刷新
- 用window.location.href实现页面跳转
- window.location.reload();页面实现跳转和刷新
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- 用window.location.href实现页面跳转
- 用window.location.href实现页面跳转
- 使用window.location.href跳转页面在IE和FF浏览器中路径不一致的问题总结