得到一个包含JSP页面的名字我有一个.JSP页面验证码:需要帮助的JavaScript
<f:view>
<div class="portletBody">
<h:form id="editSectionForm" onsubmit="return numCheck(document.forms[0].elements['editSectionForm:sectionTable:0:maxEnrollmentInput'].id)">
<sakai:flowState bean="#{editSectionBean}"/>
<t:aliasBean alias="#{viewName}" value="editSection">
<%@ include file="/inc/navMenu.jspf"%>
</t:aliasBean>
<h3><h:outputText value="#{msgs.edit_section_page_header}"/></h3>
<%@ include file="/inc/globalMessages.jspf"%>
<t:aliasBean alias="#{bean}" value="#{editSectionBean}">
<%@ include file="/inc/sectionEditor.jspf"%>
</t:aliasBean>
<t:div styleClass="act">
<h:commandButton
action="#{editSectionBean.update}"
value="#{msgs.update}"
styleClass="active"
onclick="reEnableLimits();" />
<h:commandButton action="overview" value="#{msgs.cancel}" immediate="true" />
</t:div>
</h:form>
</div>
</f:view>
和我有在/inc/sectionEditor.jspf文件运行一些JavaScript代码。在sectionEdtior文件中的某些代码中,我需要以某种方式获取此表单的ID。 editSectionForm。我不能硬编码它,因为/inc/sectionEditor.jspf代码运行在多个页面中。
那么好看多了,我需要在/inc/sectionEditor.jspf的JavaScript代码能够抓住目前它在形式的ID
即:
如果我在在editSectionForm页面中,它会告诉我该页面中的im,如果我在addSection Form页面中,它会告诉我,我在该页面上。
由于您要查找的内容发生在客户端而不是服务器上,请显示您的HTML输出。你的Java代码是不相关的。 – 2012-07-31 17:57:38