【发布时间】:2014-10-20 09:04:30
【问题描述】:
我基本上是在尝试实现这一点 http://www.impressivewebs.com/html5-form-attribute/
我有一个购物车,它正在输出并被一个 html 表夹在中间。在表格下方,我目前有我的提交按钮。
<thead>
<tr>
<th>ITEM</th>
<th>PRICE</th>
<th>WEIGHT (Kg)</th>
<th>QTY</th>
<th>SUBTOTAL</th>
<th></th>
</tr>
</thead>
<tbody>
<form action='shop.php' id='cart' method='post'>
<?php echo $cartOutput; ?>
</form>
<tr>
<td class="totals"><strong>Total</strong></td>
<td class="totals"> </td>
<td class="totals"><?php if (isset($weightTotal)) { echo $weightTotal . 'kg';} ?> </td>
<td class="totals"><?php if (isset($quantityTotal)) { echo $quantityTotal; } ?></td>
<td class="totals"><strong><?php if (isset($cartTotal)) { echo '$' . $cartTotal; } ?></strong></td>
<td class="totals"></td>
</tr>
</tbody>
/*这里的代码整理表*/
<div class="col-lg-12 col-md-12 col-xs-12 remove-padding">
<button type="submit" class="btn btn-default" form="cart" name="adjustButton" id="adjust-button">UPDATE CART</button>
<button type="button" class="btn btn-default" form="contact" name="order" id="order-button" onclick="confirmOrder()" >ORDER NOW</button>
</div>
因此,由于我希望布局看起来的方式.. 我不能将按钮放在表单内。我希望能够将更新按钮放在购物车下方。 现在订单按钮不是提交按钮,而只是一个按钮。我可以将它放在它自己的表单部分下面,但现在我通过 javascript 强制它进行确认,然后如果他们说 OK,则通过 JS 提交请求。
我想在支持包括 IE 9 +10 在内的浏览器的同时保留该功能。从我发现form="" 在 IE 中不起作用
我能做到吗?
【问题讨论】:
标签: javascript html forms form-submit