获取url参数
getQueryString(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null){
return decodeURIComponent(r[2])=="\"\"" ? "" : decodeURIComponent(r[2]);
}else{
return null;
}
}
获取Cookie
getCookie(name){
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)){
return decodeURIComponent(arr[2])=="\"\""? "" : decodeURIComponent(arr[2]);
}else{
return null;
}
}