huaisianhuang 3 роки тому
батько
коміт
72bc21797e
1 змінених файлів з 9 додано та 3 видалено
  1. 9 3
      step_question/apis/static/index-line.html

+ 9 - 3
step_question/apis/static/index-line.html

@@ -144,11 +144,17 @@
       }
       showcoffee();
 
+    function getParameterByName(name, url = window.location.href) {
+        name = name.replace(/[\[\]]/g, '\\$&');
+        var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
+            results = regex.exec(url);
+        if (!results) return null;
+        if (!results[2]) return '';
+        return decodeURIComponent(results[2].replace(/\+/g, ' '));
+    }
     function getUserid() {
-      const urlParams = new URLSearchParams(document.location.href);
-      let id = urlParams.get('userid');
+      let id = getParameterByName('userid');
       $('#userid').val(id);
-     // console.log();
     }
     getUserid();