- var getParam = function(name){
- var search = document.location.search;
- var pattern = new RegExp("[?&]"+name+"\\=([^&]+)", "g");
- var matcher = pattern.exec(search);
- var items = null;
- if(null != matcher){
- try{
- items = decodeURIComponent(decodeURIComponent(matcher[1]));
- }catch(e){
- try{
- items = decodeURIComponent(matcher[1]);
- }catch(e){
- items = matcher[1];
- }
- }
- }
- return items;
- };
- //该片段来自于http://www.codesnippet.cn/detail/2708201513559.html
来源: http://www.codesnippet.cn/detail/2708201513559.html