var url1="
http://www.runoob.com/jquery/misc-trim.html?channelid=12333&name=xiaoming&age=23";
var url2="
http://www.runoob.com/jquery/misc-trim.html";
function getParam(url,param){
var param=param;
var arr=url.split("?");
console.log(arr)
if(arr.length>1){
var arr0=arr[1].split("&");
var o={}
for(var i=0;i
var arg=arr0[i].split('=');
o[arg[0]]=arg[1]
}
console.log(o);
if(!o[param]){
alert('没找到') ;
};
return o[param]
}else{
alert('没有找到该参数')
}
};
alert(getParam(url1,'channelid'))