js中获取url?后面的参数,以及其他参数的获取
2016-04-27 15:08
549 查看
参数获取介绍:
//设置或获取对象指定的文件名或路径。
alert(window.location.pathname);
//设置或获取整个 URL 为字符串。
alert(window.location.href);
//设置或获取与 URL 关联的端口号码。
alert(window.location.port);
//设置或获取 URL 的协议部分。
alert(window.location.protocol);
//设置或获取 href 属性中在井号“#”后面的分段。
alert(window.location.hash);
//设置或获取 location 或 URL 的 hostname 和 port 号码。
alert(window.location.host);
//设置或获取 href 属性中跟在问号后面的部分。
alert(window.location.search);
跳转页面
location.href
= 'https://www.baidu.com';
相关文章推荐
- Js操作Select大全(取值、设置选中等等)
- js反选
- js 轮播图代码
- js 父窗体
- js 随机生成姓名、手机号、身份证号、银行卡号
- JSP自定义标签
- js josn prase
- d3.js——绘制打包图
- Javascript保证精度的小数乘法
- js动态改变onclick事件
- js正则关键字详解
- js正则做表单验证实例
- js利用replace方法去除敏感字符(俗称的 河蟹!!!)
- JS中六种数据类型(五)——String
- js使用正则写getClass
- js正则常用的方法
- js form表单发送数据两种方式(post get)区别
- JSP中解决获取请求参数中文乱码问题
- js原声ajax包(兼容个浏览器)
- js跨域实例(利用百度搜索引擎模拟百度搜索)