<script>
<%
String s2 = (String)request.getParameter("参数名");//获取后台参数给s2变量,<%%>表示这范围内是服务器解析的语言
%>
var s = '<%=s2%>';//输出s2给js变量s
</script>
function GetQueryString(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
}
var loc = GetQueryString("id");