Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 怎样判断checkbox的个数
redhobor





发贴: 5
于 2005-03-10 18:28 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
对javascript不熟,弄了半天没结果,只好求教于各位老大了。
<script language="javascript" type="">
<!--
//This function processes events of update or delete user
function sendData(num){
if(num=='1'){
document.frm.action="updateuser.jsp";
}
else if(num=='2'){
document.frm.action="deleteuser.jsp";
}
document.frm.submit();
}
<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=\"usr_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="button" name="adduser" value="Add" onclick="doChange()">
<input type="submit" name="updateuser" value="Update" onclick="sendData('1')">
<input type="submit" name="deleteuser" value="Delete" onclick="sendData('2')">
</p>
</form>
CHECKBOX在Update时只能选取一个,而在删除时可以选择多个。所以我想了解用javascript方法来取到已经Checked的类别的个数。在Submit时,可以即时判断并显示window.alert()




话题树型展开
人气 标题 作者 字数 发贴时间
3089 怎样判断checkbox的个数 redhobor 1791 2005-03-10 18:28
2682 Re:怎样判断checkbox的个数 wmgreat 672 2005-03-10 20:51
2501 Re:怎样判断checkbox的个数 chengbd 26 2005-03-11 00:37
2579 Re:怎样判断checkbox的个数 redhobor 454 2005-03-11 04:05
2706 Re:怎样判断checkbox的个数 wmgreat 21 2005-03-11 16:29
2649 Re:怎样判断checkbox的个数 xiongjy 1121 2005-03-12 23:03

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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