JS获取地址栏参数

 

//获取地址栏参数 name为参数的字段如?name=xxx
function GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r!=null) return unescape(r[2]); return null;
}

posted @ 2016-01-25 19:52  二年后的今天  阅读(182)  评论(0编辑  收藏  举报