Skip to content

Instantly share code, notes, and snippets.

@jumplee
Created August 9, 2015 09:08
Show Gist options
  • Select an option

  • Save jumplee/a85dbc37cab2d05ce628 to your computer and use it in GitHub Desktop.

Select an option

Save jumplee/a85dbc37cab2d05ce628 to your computer and use it in GitHub Desktop.
function getParam(param){
var url=location.href;
var reg =new RegExp(param+'=(.*)');
var index=url.indexOf('?');
var param_str=url.substr(index);
var paramArray=reg.exec(param_str);
if(paramArray.length==2){
return paramArray[1];
}else{
return '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment