// 获取url中查询字符串参数 例如http://www.test.com?a=1&b=2 function RequestParamete() { var url = window.location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); var strs = str.spl…
一:后台获取,前台调用 后台: object value= Request.QueryString[key]; 前台js: $(function(){ var value="<%=value %>" }) 二:用js方法写正则判断 //获取URL中参数 function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)&quo…
解决方法 function getQueryString(key){ var reg = new RegExp("(^|&)"+key+"=([^&]*)(&|$)"); var result = window.location.search.substr(1).match(reg); return result?decodeURIComponent(result[2]):null; } 下面的这种方法获取到url中的中文参数是乱码 /*fu…
function GetRequest() { 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 ++) { t…
实例代码test.js var http=require('http'); var url=require('url'); var querystring=require('querystring'); http.createServer(function(request, response) { var urlStr = request.url; var methodName = urlStr.substring(1, urlStr.indexOf('?')); console.log('me…
该方法基于JQuery,然后给方法传递URL中的参数名,返回参数值 (function($){ $.getUrlParam = function(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null)…