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('沒(méi)找到')?;
};
return?o[param]
}else{
alert('沒(méi)有找到該參數(shù)')
}
};
alert(getParam(url1,'channelid'))