js中获取URL参数的共通方法getRequest()方法
程序员文章站
2022-07-01 20:52:58
getRequest : function() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.indexOf("?") != -1) { va... ......
getrequest : function() { var url = location.search; //获取url中"?"符后的字串 var therequest = new object(); if (url.indexof("?") != -1) { var str = url.substr(1); strs = str.split("&"); for(var i = 0; i < strs.length; i ++) { therequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); } } return therequest; }
上一篇: JavaScript 系列博客(六)