我有一张这样的桌子:
<tr class="product">
<td><input class ="parts" id="tf1" type="text" style="width:327px"/></td>
<td><input class ="parts" id="tf2" type="text" style="width:51px";"/></td>
<td><input class ="parts" id="tf3" type="text" style="width:144px";"/></td>
<td><input class ="parts" id="tf4" type="text" style="width:64px";"/></td>
<td><input class ="parts" id="tf5" type="text" style="width:81px";"/></td>
<td><input class ="parts" id="tf6" type="text" style="width:12px";"/></td>
<td><input class ="parts" id="tf7" type="text" style="width:21px";"/></td>
<td><input class ="parts" id="tf8" type="text" style="width:22px";"/></td>
<td><input class ="parts" id="tf9" type="text" style="width:22px";"/></td>
<td><input class ="parts" id="tf10" type="text" style="width:60px";"/></td>
<td><input class ="parts" id="tf11" type="text" style="width:35px";"/></td>
<td><input class ="parts" id="tf12" type="text" style="width:41px";"/></td>
<td><input class ="parts" id="tf13" type="text" style="width:50px";"/></td>
<td><input class ="parts" id="tf14" type="text" style="width:44px";"/></td>
<td><input type="button" class="addRow" value="Add"/></td>
<td><input type="button" class="delRow" value="Delete"/></td>
</tr>
我想迭代通过表行的每个字段,并标记结果,并将其与php邮件发送到电子邮件地址。我认为它相当简单,但不知何故不起作用。我试着使用这个函数:
function fill(){
var value = $find.("tr.product.input.parts").html();
return value;
}
发布于 2011-10-28 00:39:37
假设您的addRow和delRow按钮正在工作,因为您没有提到任何相关内容:
将您的输入名称改为array。因此,不是
<td><input class ="parts" id="tf1" type="text" style="width:327px"/></td>
<td><input class ="parts" id="tf2" type="text" style="width:51px"/></td>
<td><input class ="parts" id="tf3" type="text" style="width:144px"/></td>
你应该使用
<td><input class ="parts" id="tf1" name="tf[]" type="text" style="width:327px"/></td>
<td><input class ="parts" id="tf2" name="tf[]" type="text" style="width:51px"/></td>
<td><input class ="parts" id="tf3" name="tf[]" type="text" style="width:144px"/></td>
当使用PHP处理时,所有的值都将以数组形式出现在$_POST‘’tf‘中,从索引0开始。有了这个,你可以循环和处理它,并通过电子邮件发送它。
无论如何,我想知道为什么您的文本字段有不同的宽度,而style=" width :327px";“是一个错误的标记。
https://stackoverflow.com/questions/7923449
复制相似问题