JS中怎么调用<%%>的值

JS中怎么调用<%%>的值

示例代码一:

<% 
String usercode = request.getParameter("usercode");//用request得到 
%>
<script  type="text/javascript">  

    function toGjzxt(){
        var usercode = "<%=usercode %>";//获取usercode参数值
    }
</script>

示例代码二:

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
//注意在Script的标签里面拼接不加“+”号 <script type="text/javascript" src="<%= path %>/scripts/jquery-1.7.2.min.js"></script>

 

posted @ 2017-12-08 13:12  整合侠  阅读(17264)  评论(0编辑  收藏  举报