将Jsp变量作为函数参数传递给javascript [英] Passing Jsp variable to javascript as a function parameter
本文介绍了将Jsp变量作为函数参数传递给javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有相同的查询.
将JSP变量作为参数传递给javascript函数
但是,如果我使用onclick="pagetype('<%=uname%>');
,则会出现类型错误的非法开始.请帮助解决此问题.
I have the same query as.
Pass a JSP variable as parameter to javascript function
However, If i use onclick="pagetype('<%=uname%>');
i'm getting illegal start of type error. Please help to fix this.
是..<%@页面contentType ="text/html" pageEncoding ="UTF-8"%>
Yes.. <%@ page contentType= "text/html" pageEncoding="UTF-8" %>
推荐答案
-
String date1
在循环内.您将无法获得其价值. - 将
alert2('<%=date1');
更改为alert2('<%= date1 %>');
String date1
is inside a loop. You won't be able to get its value outside.- change
alert2('<%=date1');
toalert2('<%= date1 %>');
这篇关于将Jsp变量作为函数参数传递给javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文