获取window.location.search的参数

2020-05-27  本文已影响0人  觉上云来
var getRequest = function() { var url = window.location.search; var strs = []; 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]]=decodeURIComponent(strs[i].substring(strs[i].indexOf('=')+1)); } } return theRequest;};
上一篇下一篇

猜你喜欢

热点阅读