url 地址如: http://localhost/1.html?id=1&page=2#section=3
js代码
window
.location.href
获取到:
http://localhost/
1.html?id=
1&page=
2#section=3
location.search
?id=
1&page=2
location
.hash
#section=3
共同点 location.href,location.search和location.hash都可以赋值。 区别: location.href,location.search接受赋值(即使不改变值),会刷新页面。 location.hash接受赋值,不会刷新页面。
引用地址: http://www.jianshu.com/p/05600ca9a90f
jsp如何获取地址栏附带的参数 http地址栏的地址如下: http://localhost/1.html?id=1&page=2#section=3 使用jstl获取
${param
.id}
相当于:request
.getParameter(
"id")。意思是获得输入的参数id。