解决方法 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
1.在页面中对你的URL进行编码 使用------encodeURI(你要使用的中文参数值)如:...?username"+encodeURI(“小甜甜") 2.在后台通过解码来接收该中文参数 使用----String name = new String(request.getParameter("username ").getBytes("iso8859-1"),"utf-8") 3.最好不要在URL中传递中文参数