<form name="form1" method="post" action="checkstore.jsp">
  <table width="508" height="113" border="1" summary="dd">
    <caption align="top">
    <span class="style1">    库存查询
    </span>
    </caption>
    <tr>
      <td width="87" height="40">货号<input type="checkbox" name="checkhuohao"> </td>
      <td width="173"><input name="huohao" type="text"></td>
      <td width="52">名称<input type="checkbox" name="checkmingcheng" ></td>
      <td width="168"><input type="text" name="mingcheng"></td>
    </tr>
   </table>
      <input type="submit" name="Submit" value="提交">
我想完成如果选中复选筐就把文本筐中的信息 提交数据库 ,应怎样在 下一页面 提交和设置呢?

解决方案 »

  1.   

    checkbox有一个onselect事件,在这个事件中写就行了
      

  2.   

    后台判断能否取到checkbox的值,如果能取到就取text的值,保存数据库。
    在网页中,如果checkbox没有被选中,后台是取不到值的。
      

  3.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
    <title>Untitled Document</title>
    </head><body>
    <form name="form1" method="post" action="checkstore.jsp">
      <table width="508" height="113" border="1" summary="dd">
        <caption align="top">
        <span class="style1">    库存查询
        </span>
        </caption>
        <tr>
          <td width="87" height="40">货号<input type="checkbox" name="checkhuohao" > </td>
          <td width="173"><input name="huohao" type="text"></td>
          <td width="52">名称<input type="checkbox" name="checkmingcheng"  onclick="alert(this.checked);if(this.checked) form1.submit();"></td>
          <td width="168"><input type="text" name="mingcheng"></td>
        </tr>
       </table>
          <input type="submit" name="Submit" value="提交">
    </form>
    </body>
    </html>
      

  4.   

    看看这样能不能满足你的要求,至于你说的数组因为不知道你想弄成什么样的,要你自己在写了。
    <script language="javascript">
    function formsubmit()
    {
    if(document.form1.checkhuohao.checked==false){
    document.form1.huohao.value="";
    }else{
    if (document.form1.huohao.value=="")
    {
    alert("请输入货号");
    return false;
    }
    }

    if(document.form1.checkmingcheng.checked==false)
    {
    document.form1.mingcheng.value="";
    }else{
    if (document.form1.mingcheng.value=="")
    {
    alert("请输入名称");
    return false;
    }
    }
    document.form1.submit();

    }
    </script>
    <form name="form1" method="post" action="checkstore.jsp">
      <table width="508" height="113" border="1" summary="dd">
        <caption align="top">
        <span class="style1">    库存查询
        </span>
        </caption>
        <tr>
          <td width="87" height="40">货号<input type="checkbox" name="checkhuohao"> </td>
          <td width="173"><input name="huohao" type="text"></td>
          <td width="52">名称<input type="checkbox" name="checkmingcheng" ></td>
          <td width="168"><input type="text" name="mingcheng"></td>
        </tr>
       </table>
          <input type="button" name="Submit" value="提交" onClick="formsubmit()">
    </form>