标签:
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; }
例如url:
http://192.168.1.1/hello.html?id=123123&name=jimmy
现在解析出id和name的值
var id=GetQueryString(‘id‘);
var name=GetQueryString(‘jimmy‘);
标签:
原文地址:http://www.cnblogs.com/JimmyBright/p/4570672.html