js 获取ur参数 只要问号后面的那段传进url
//获取url中的参数
function getUrlParam (pName, win) {
var sUrl;
if (typeof (win) == 'string') {
sUrl = win;
if (sUrl.indexOf('?') < 0) sUrl = '?' + sUrl;
} else {
if (!win) win = window;
sUrl = win.location.search;
}
var iQ = sUrl.indexOf('?') + 1;
if (iQ > 0) {
sUrl = '&' + sUrl.substring(iQ, sUrl.length);
iQ = sUrl.indexOf('?'); //url参数中还存在url?
var key = '&' + pName + '=';
var i = sUrl.indexOf(key);
if (i > -1) {
var j = sUrl.indexOf('&', i + 1); //&Key=Val&Key2=...
if (j < 0 || (iQ > 1 && j > iQ)) j = sUrl.length;
return unescape(sUrl.substring(i + key.length, j));
}
}
return null;
};