我有一个包含以下代码的页面:
<td id="td-id-<%=tdId%>" class="<%
if (scheduleList.get(key) != null && scheduleList.get(key).length() > 0) {
if (scheduleList.get(key).contains("RESERVED")) {
out.print("reserved-schedule");
} else if (scheduleList.get(key).contains("AVAILABLE")) {
out.print("open-schedule");
} else {
out.print("closed-schedule");
}
} else {
out.print("closed-schedule");
}
%>">
<%-- end of color --%>
<%-- text inside the box --%>
<%
if (scheduleList.get(key) != null && scheduleList.get(key).length() > 0) {
if (key.contains("RESERVED")) {
out.print(scheduleList.get(key).split("-")[3]);
} else if (scheduleList.get(key).contains("AVAILABLE")) {
out.print(rb.getString("teacher.submit.open.lessons").replace(" lessons", ""));
} else {
out.print(rb.getString("teacher.submit.close.lessons").replace(" lessons", ""));
}
} else {
out.print(rb.getString("teacher.submit.close.lessons").replace(" lessons", ""));
}
//out.print(" " + cal.getTimeInMillis() / 1000);
%>
<input type="hidden" class="td-id" value="<%=tdId%>"/>
<%out.print(tdId);%>
<%-- end of text inside the box --%>
</td>
我想根据我将选择的 td 获取 id(它允许您选择单个或多个 td),该代码位于循环内,该循环在 1 行中打印 7 个 td。这包括每个 td 中的唯一 ID。这怎么可能。谢谢你。