Topic: 不同的按键怎样连接到不同的JSP网页

  Print this page

1.不同的按键怎样连接到不同的JSP网页 Copy to clipboard
Posted by: redhobor
Posted on: 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>

2.Re:不同的按键怎样连接到不同的JSP网页 [Re: redhobor] Copy to clipboard
Posted by: wmgreat
Posted on: 2005-03-06 00:26

Your code can implment the function your wanted,but your must change "==" to "="

document.frm.action==/adduser.jsp; Do you konw?

3.Re:不同的按键怎样连接到不同的JSP网页 [Re: wmgreat] Copy to clipboard
Posted by: redhobor
Posted on: 2005-03-06 00:42

THX


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923