String.prototype.getQuery = function(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = this.substr(this.indexOf("\?")+1).match(reg); if (r!=null) return unescape(r[2]); return null; }var s =…
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…
function getAllUrlParams(url) { // get query string from url (optional) or window var queryString = url ? url.split('?')[1] : window.location.search.slice(1); // we'll store the parameters here var obj = {}; // if query string exists if (queryString)…
原理跟取cookie值一样的 function getParamer(paramer){ var url=window.location.href.split("?")[1];/*获取url里"?"后面的值*/ if(url.indexOf("&")>0){/*判断是否是一个参数还是多个参数*/ urlParamArry=url.split("&");/*分开每个参数,并放到数组里*/ …
实例代码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…
一:后台获取,前台调用 后台: object value= Request.QueryString[key]; 前台js: $(function(){ var value="<%=value %>" }) 二:用js方法写正则判断 //获取URL中参数 function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)&quo…