justcode.ikeepstudying.com
javascript 获取url参数, Get URL Parameters With JavaScript - Just Code
有个url如下: http://example.com/?product=shirt&color=blue&newuser&size=m 我们该如何获取from这个参数的值呢? 方法一: function getAllUrlParams(url) { // get query string from url (optional) or window var queryString = url ? url.split('?')[1] : window.location.search.slice(1); // we'll store the parameters here var obj = {}; // if query string exists if (queryString) { // stuff after # is not part of query string, so […]
Gideon