2011-05-16 53 views
0

您好,我创建了一个表的表列的一个是一个复选框和其他数据 现在我知道我可以使用复选框后一个值BT我怎么能发送整个排 即当用户选中复选框的ID,标题,描述....... REQ量被贴到checkbox被选中,并根据该过程中的所有在servlet检查这个servlet使用复选框以发送多个值

<table border="1" cellpadding="6" cellspacing="4" 
     style="border-collapse: collapse" width="200%" id="AutoNumber1" 
     align="center" bordercolorlight="#800000" bordercolordark="#800000 " class="left" > 
    <tr> 
     <td width="5%" align="center"> 
      <input type="checkbox" id=checked" value=<%= id%>/> 
      <font face="Arial" size="3" color="light blue"> 
      Options</font> 
     </td> 
     <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Title</font> 
     </td> 
     <td width="40%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Description</font> 
     </td> 

       <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Company</font> 
     </td> 
     <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Province</font> 
     </td> 
      <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      District</font> 
     </td> 
      <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Actual Quantity</font> 
       </td> 
     <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Required Quantity</font> 

     </td> 
    </tr> 
</table> 
+0

你的问题我也不清楚 – 2011-05-16 06:23:30

+0

@Jigar:据我了解OP要提交其复选框被选中整行的数据。 – 2011-05-16 06:26:59

+0

@ahsan如果@Harry是正确的,那么封装的形式一切并处理该复选框被选中的行。 – 2011-05-16 06:29:10

回答

0

其他数据。 e.g,如果你的HTML看起来像这样:

<table border="1" cellpadding="6" cellspacing="4" 
     style="border-collapse: collapse" width="200%" id="AutoNumber1" 
     align="center" bordercolorlight="#800000" bordercolordark="#800000 " class="left" > 
    <tr> 
     <td width="5%" align="center"> 
      <input type="checkbox" id="checkbox_1" value=<%= id%>/> 
      <font face="Arial" size="3" color="light blue"> 
      Options1</font> 
     </td> 
     <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Title</font><input id="title_1" /> 
     </td> 
     <td width="40%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Description</font><input id="description_1" /> 
     </td> 

    </tr> 
     <tr> 
     <td width="5%" align="center"> 
      <input type="checkbox" id="checkbox_2" value=<%= id%>/> 
      <font face="Arial" size="3" color="light blue"> 
      Options2</font> 
     </td> 
     <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Title</font><input id="title_2" /> 
     </td> 
     <td width="40%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Description</font><input id="description_2" /> 
     </td> 

    </tr> 
</table> 

比你的servlet,检查是否checkbox_1选择?如果是,则进程title_1description_1。并应用相同的逻辑checkbox_2title_2 & description_2

+0

的问题是,整个表被从数据库填充,我使用JSON打印的HTML页面上,因此是完全动态的,我不认为上述shceme将适合 – ahsan 2011-05-16 07:13:41

+0

如果我不使用此ID '复选框[ID]' 的ID和复选框[ID] [名]为标题,将工作 – ahsan 2011-05-16 09:16:20

+0

@ahsan,这就是伟大的。我只是提出了一个非常基本的想法。您必须根据您的要求调整它。 – 2011-05-16 09:20:23