{"action":"opened","issue":{"url":"https://api.github.com/repos/ye63/ye63.github.io/issues/3","repository_url":"https://api.github.com/repos/ye63/ye63.github.io","labels_url":"https://api.github.com/repos/ye63/ye63.github.io/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/ye63/ye63.github.io/issues/3/comments","events_url":"https://api.github.com/repos/ye63/ye63.github.io/issues/3/events","html_url":"https://github.com/ye63/ye63.github.io/issues/3","id":309691066,"number":3,"title":"JavaScript取url参数","user":{"login":"ye63","id":22697565,"avatar_url":"https://avatars1.githubusercontent.com/u/22697565?v=4","gravatar_id":"","url":"https://api.github.com/users/ye63","html_url":"https://github.com/ye63","followers_url":"https://api.github.com/users/ye63/followers","following_url":"https://api.github.com/users/ye63/following{/other_user}","gists_url":"https://api.github.com/users/ye63/gists{/gist_id}","starred_url":"https://api.github.com/users/ye63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ye63/subscriptions","organizations_url":"https://api.github.com/users/ye63/orgs","repos_url":"https://api.github.com/users/ye63/repos","events_url":"https://api.github.com/users/ye63/events{/privacy}","received_events_url":"https://api.github.com/users/ye63/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-29T09:52:50Z","updated_at":"2018-03-29T09:52:50Z","closed_at":null,"author_association":"OWNER","body":"```js\r\n\r\n//取url参数(不支持中文解码）\r\ngetRequest() {\r\n\tvar url = location.search;\r\n\tvar theRequest = new Object();\r\n\tif (url.indexOf(\"?\") != -1) {\r\n\t\tvar str = url.substr(1);\r\n\t\tvar strs = str.split(\"&\");\r\n\t\tfor (var i = 0; i < strs.length; i++) {\r\n\t\t\ttheRequest[strs[i].split(\"=\")[0]] = unescape(strs[i].split(\"=\")[1]);\r\n\t\t}\r\n\t}\r\n\treturn theRequest;\r\n}\r\n\r\n//取url参数 方法2(支持中文解码，frank 2018年2月5日)\r\nUrlSearch() {\r\n\tvar name, value;\r\n\tvar str = location.href; //取得整个地址栏\r\n\tvar num = str.indexOf(\"?\")\r\n\tstr = str.substr(num + 1); //取得所有参数 stringvar.substr(start [, length ]\r\n\r\n\tvar arr = str.split(\"&\"); //各个参数放到数组里\r\n\tfor (var i = 0; i < arr.length; i++) {\r\n\t\tnum = arr[i].indexOf(\"=\");\r\n\t\tif (num > 0) {\r\n\t\t\tname = arr[i].substring(0, num);\r\n\t\t\tvalue = arr[i].substr(num + 1);\r\n\t\t\tthis[name] = value;\r\n\t\t}\r\n\t}\r\n}\r\n```"}}
{"actor":{"display_login":"ye63"}}