<html>
<head>
<title>
Test
</title>
<script type="text/javascript">
<!--
function fnc()
{
var sum1=0;
if (document.form1.chc[0].checked==true)
{
sum1=sum1+parseInt(document.form1.txt0.value);}if (document.form1.chc[1].checked==true){
sum1=sum1+parseInt(document.form1.txt1.value);
}if (document.form1.chc[2].checked==true){
sum1=sum1+parseInt(document.form1.txt2.value);}if (document.form1.chc[3].checked==true){
sum1=sum1+parseInt(document.form1.txt3.value);}if (document.form1.chc[4].checked==true){
sum1=sum1+parseInt(document.form1.txt4.value);}
alert(sum1)
}
-->
</script></head>
<body>
<form name="form1">
<table>
<tr>
<th>
checkbox
</th>
<th>
zhanghao
</th>
<th>
name
</th>
<th>
Address
</th>
<th>
Money
</th>
</tr>
<tr>
<td>
<input type = 'checkbox' name = 'chc' value = "0">
</td>
<td>
<input type = 'text'  value = "01">
</td>
<td>
<input type = 'text' value = "aa">
</td>
<td>
<input type = 'text' value = "bb">
</td>
<td>
<input type = 'text' name = 'txt0' value = "1000">
</td>
</tr>
<tr>
<td>
<input type = 'checkbox' name = 'chc' value = "1">
</td>
<td>
<input type = 'text'  value = "01">
</td>
<td>
<input type = 'text' value = "aa">
</td>
<td>
<input type = 'text' value = "bb">
</td>
<td>
<input type = 'text' name = 'txt1' value = "2000">
</td>
</tr>
<tr>
<td>
<input type = 'checkbox' name = 'chc' value = "2">
</td>
<td>
<input type = 'text'  value = "01">
</td>
<td>
<input type = 'text' value = "aa">
</td>
<td>
<input type = 'text' value = "bb">
</td>
<td>
<input type = 'text' name = 'txt2' value = "3000">
</td>
</tr>
<tr>
<td>
<input type = 'checkbox' name = 'chc' value = "3">
</td>
<td>
<input type = 'text'  value = "01">
</td>
<td>
<input type = 'text' value = "aa">
</td>
<td>
<input type = 'text' value = "bb">
</td>
<td>
<input type = 'text' name = 'txt3' value = "4000">
</td>
</tr>
<tr>
<td>
<input type = 'checkbox' name = 'chc' value = "4">
</td>
<td>
<input type = 'text'  value = "01">
</td>
<td>
<input type = 'text' value = "aa">
</td>
<td>
<input type = 'text' value = "bb">
</td>
<td>
<input type = 'text' name = 'txt4' value = "5000">
</td>
</tr>
</table>
<input type="button" value="submit" onclick="fnc();">
</form>
</body>
</head>
</html>
最后只把sum1提交就行了
如果是个循环,只要改个变量命名就行了。基本上我的思路就是这样了。

解决方案 »

  1.   

    sum1等于checkbox.value是 如果这个直是数据库中该记录的id号.是不是这条记录被提交?
      

  2.   

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    var checkflag = "false";
    function check(field) {
    if (checkflag == "false") {
    for (i = 0; i < field.length; i++) {
    field[i].checked = true;}
    checkflag = "true";
    return "取消全选"; }
    else {
    for (i = 0; i < field.length; i++) {
    field[i].checked = false; }
    checkflag = "false";
    return "全部选定"; }
    }
    // End -->
    </script>
    ---------------------这是一个动态的,从数据库中获取唯一的值,作为复选框的值---------------------
    <td align="center" bgcolor="#00CCFF"><input type=button value=" 全部选定 " onClick="this.value=check(this.form.list)">&nbsp;&nbsp;</td>
    <table border="1"  bordercolor="#008080" cellspacing="0" bgcolor="#f6f6f6" cellpadding="0" align="center">
      <tr>
        <td width="8" bgcolor="#00CCFF">&nbsp;</td>
       </tr>
      <tr>
        <td width="8" bgcolor="#00CCFF"><INPUT TYPE="checkbox" NAME="list" Value=<%=rs(0)%>></td>
       </tr>
    </table>
    --------------------------------------------------------
    下面实执行
    <%
    FOR EACH list in request.form("list")
    sql="update table set 字段=true where 数据库中和复选框中一样的值ID="&list&""
    set objrs=conn.execute(sql)
    next
    %>
      

  3.   

    sql="update table set 字段=值 where 数据库中和复选框中一样的值ID="&list&""