//Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request // eg. /manage/editExam.domethod=goExamSet&type=U String url = request.getRequestURI(); //The re…
方法1: function getRequest(strParame) { var args = new Object(); var query = location.search.substring(1); var pairs = query.split("&"); // Break at ampersand for (var i = 0; i < pairs.length; i++) { var pos = pairs[i].indexOf('='); if (po…
<html> <body> 浏览器中输入 http://localhost/test/js_url.php?a1=aaa&a2=bbb&a3=ccc 会依次弹出aaa,bbb,ccc <script type="text/javascript"> //方法一 function GetQueryString(name) { var reg = new RegExp("(^|&)"+ name +&q…
一:后台获取,前台调用 后台: object value= Request.QueryString[key]; 前台js: $(function(){ var value="<%=value %>" }) 二:用js方法写正则判断 //获取URL中参数 function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)&quo…
用过的封装好的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…
多浏览器兼容用javascript获取url参数的方法比较推荐的一种 <script language = javascript> function request(paras){ var url = location.href; var paraString = url.substring(url.indexOf("?")+1,url.length).split("&"); var paraObj = {} for (i=0; j=paraSt…
方法一:正则法 复制代码代码如下: 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;}//…