使用javascript从jsp页面获取id

时间:2013-05-09 07:31:49

标签: java javascript jsp

我有一个包含以下代码的页面:

<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。怎么可能。谢谢。

0 个答案:

没有答案