前端JS解析url参数及客户端环境
2012-04-08 20:17
465 查看
//获得 GET参数
function $_GET( ) {
var re = new RegExp("([^\&\?]*)=([^\&]*)", "i");
var a = re.exec(document.location.search);
window.GET = [];
while (a){
GET[a[1]] = a[2];
a = re.exec(document.location.search);
}
return GET;
};
其它参数
//获得域名地址 location.origin
//获得文件路径 location.pathname
//获得hash字符串 location.hash
//获得历史页面步骤 history.length
//获得cookie document.cookie
function $_GET( ) {
var re = new RegExp("([^\&\?]*)=([^\&]*)", "i");
var a = re.exec(document.location.search);
window.GET = [];
while (a){
GET[a[1]] = a[2];
a = re.exec(document.location.search);
}
return GET;
};
其它参数
//获得域名地址 location.origin
//获得文件路径 location.pathname
//获得hash字符串 location.hash
//获得历史页面步骤 history.length
//获得cookie document.cookie
相关文章推荐
- Web前端面试题 Js把URL中的参数解析为一个对象
- 【前端Js】jQuery获取(URL)地址栏参数
- JSP 中js传递和解析URL参数以及中文转码和解码
- JS中利用location.search在客户端获取URL参数
- js解析当前页面url获取参数
- JS解析URL中的参数
- JS解析URL参数并返回JSON格式
- 分享关于js解析URL中的参数的方法
- Js把URL中的参数解析为一个对象
- BASE64-客户端(js)加码-服务器端(c#)解码,URL传递“汉字参数”解决方法
- [js]解析url中的get参数为一个对象
- js 解析 分割 获取 URL 参数
- js正则解析URL参数示例代码
- javascript BASE64-客户端(js)加码-服务器端(c#)解码,URL传递“汉字参数”解决方法
- 监听URL内容的JS交互-与解析URL内的参数
- js解析url参数返回json格式
- JSP中js传递和解析URL参数以及中文转码和解码问题
- JSP中js传递和解析URL参数以及中文转码和解码问题
- js解析url参数如http://www.taobao.com/index.php?key0=21&key1=你哈&(获取key0和key1的值)
- 【前端】使用JS替换URL的参数(代码案例)