js 模拟取得 get参数 /**/ /** * 功能:通过截取url,模拟取得get参数 */ function getParameter(p) { var url=window.location.toString(); var str="{0:0}"; if(url.indexOf("?")!=-1){ //判断有没有参数 str = ""; var ary=url.split("?")[1].split("&"); for(var i in ary){ str+= ary[i].split("=")[0]+":"; //参数名称 str+= ary[i].split("=")[1]+","; //参数值 } str = "{" + str.substring(0,str.length-1) + "}"; } eval("Pram=" + str) return eval("Pram." + p);} 转载于:https://www.cnblogs.com/bboy/archive/2008/07/21/1247580.html