浏览代码

Better parsing of query string variables

Giannis Kosmas 11 年之前
父节点
当前提交
d8c0953567
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      include/webutil.js

+ 1 - 1
include/webutil.js

@@ -78,7 +78,7 @@ WebUtil.dirObj = function (obj, depth, parent) {
 
 // Read a query string variable
 WebUtil.getQueryVar = function(name, defVal) {
-    var re = new RegExp('[?][^#]*' + name + '=([^&#]*)'),
+    var re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
         match = document.location.href.match(re);
     if (typeof defVal === 'undefined') { defVal = null; }
     if (match) {