0
一個字符串變量傳遞給JavaScript的onClick功能在我的JSP中,我有這樣的事情如何在JSP
<%
String isMultipleOfficesExists = (String)request.getAttribute("MultipleOfficesExists");
String isMultipleOfficeSecurity = (String)request.getAttribute("MultipleOfficeSecurityExists");
String envParm = "default";
if("true".equals(isMultipleOfficesExists)){
envParm = "multipleOffice";
}else if("true".equals(isMultipleOfficeSecurity)){
envParm = "multipleOfficeSecurity";
}
%>
在我的底部形態,在我提交按鈕,我調用JavaScript在點擊功能。
<input class="white_button_extra_large" type="button" value="<%=goBtn%>" onclick="javascript:selectEnvironment(envParm);">
我的腳本部分是:
function selectEnvironment(envParm)
{
resetToken();
logoutFlag = false;
document.forms[0].action = contextURL+'/login/selectEnvironment?envParam=' +envParm;
document.forms[0].submit();
}
但我正在逐漸Uncaught ReferenceError: envParam is not defined
我怎樣才能解決這個問題?
謝謝。它爲我工作 – sreehari