function QueryString() { var data = []; this.Read = function() { var aPairs, aTmp; var queryString = new String(window.location.search); queryString = queryString.substr(1, queryString.length); //remove "?" aPairs = queryString.split("&…
用过的封装好的js获取url问号后的参数的方法: <script> var Request = new Object(); Request = GetRequest();var error;error = Request['error']; function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.i…
方法一:正则法 复制代码代码如下: function getQueryString(name) { var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null;}//…
js获取url参数值的方法有很多,下面也为大家介绍两种. 方法一:正则分析法 function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return u…
js获取url参数的方法有很多. 1.正则分析 function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); retur…
/** * js获得url内的参数 * 返回值: string or undefined * 使用方法:$_GET['from'] */ var $_GET = (function() { var search = location.search; if (search == '') { return {}; } search = search.split('?')[1]; search = search.split('&'); var get = {}; for (var i in searc…