jsp 질문 드립니다.
글쓴이: lalupo20 / 작성시간: 토, 2020/10/17 - 2:22오후
try { Connection con = DriverManager.getConnection(url, id, pw); Statement stat = con.createStatement(); String sql = "SELECT id, comment, userName, time FROM comments where postNum=" + idx; ResultSet rs = stat.executeQuery(sql); while (rs.next()) { int commentsId = rs.getInt(1); String comment = rs.getString(2); String userName = rs.getString(3); String commentTime = rs.getString(4); %> <form action="comment_delete_ok.jsp"> <table> <tr> <td align="left" width="120"><b><%=userName %></b> <input type="hidden" name="commentsId" value="<%=commentsId %>"> <input type="hidden" name="postId" value="<%=idx %>"></td> <td width="638" align="left"><%=comment %></td> <td width="0"><%=commentTime %></td> </tr> <tr> <td colspan="2"> <input type="submit" value="수정" name="delete"> <input type="submit" value="삭제" name="delete"> </td> </tr> <tr height="1" bgcolor="#dddddd"><td colspan="4" width="407"></td></tr> </table> </form> <% } rs.close(); stat.close(); con.close(); }catch(Exception e) { } %>
위와 같은 코드에서 수정버튼을 누르면
이부분 코드를 textarea로 변경되게 하고 싶은데 어떻게 해야하는지 알려주실 수 있을까요?
Forums:
js를 이용하셔야겠네요
<%=comment %> 의 상위태그인 <td width="638" align="left"><%=comment %></td> 여기에 id를 달아서
<td width="638" align="left" id="test"><%=comment %></td>
이런 식으로 만든 후
버튼 클릭시 id가 test인 것의 내부 html을 변경하시면 되겠습니다.
구현했습니다.
감사합니다.
ㄴ감사합니다!
내일 해볼께요
댓글 달기