redhobor
发贴: 5
|
于 2005-03-05 21:42
想让不同的按键连接到不同的JSP网页,我的代码应该怎么修改?先谢谢各位。 <script language="javascript" type=""> <!-- function sendData(num){ if(num=='1'){ document.frm.action=="/adduser.jsp"; } else if(num=='2'){ document.frm.action=="/updateuser.jsp"; } else if(num=='3'){ document.frm.action=="/deleteuser.jsp"; } document.frm.submit(); } //--> </script><!-- // --> <center> <form name="frm" method="post"> <table width="75%" border="0"> <tr bgcolor="#CCCCCC"> <td> </td> <td>ID</td> <td>Surname</td> <td>Forename</td> <td>Privilege</td> </tr> <% ResultSet rs = (ResultSet) request.getAttribute("userinfo"); while (rs.next()) { usr_id = rs.getString("usr_id"); usr_surname = rs.getString("usr_surname"); usr_forename = rs.getString("usr_forename"); usr_privilege = rs.getString("usr_privilege"); out.print("<tr><td><input type=\"checkbox\" name=\"ID\" value=\"" + usr_id + "\"></td>"); out.print("<td>" + usr_id + "</td>"); out.print("<td>" + usr_surname + "</td>"); out.print("<td>" + usr_forename + "</td>"); out.print("<td>" + usr_privilege + "</td></tr>"); } rs.close(); %> </table> <p> </p> <p> <input type="submit" name="adduser" value="Add" onclick="sendData('1')"> <input type="submit" name="updateuser" value="Update" onclick="sendData('2')"> <input type="submit" name="deleteuser" value="Delete" onchange="sendData('3')"> </p> </form>
|