js - get-the-value-from-the-url-parameter(可以在非模态对话框中使用)

  ref: http://*.com/questions/979975/how-to-get-the-value-from-the-url-parameter

  函数:

function getQueryParams(qs) {
qs = qs.split("+").join(" "); var params = {}, tokens,
re = /[?&]?([^=]+)=([^&]*)/g; while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
} return params;
}

然后可以通过这样方式访问:  
  //var query = getQueryParams(document.location.search);
  //alert(query.foo);

上一篇:jQuery之Nestable


下一篇:Android应用中使用百度地图API之POI(三)