1 回答
TA贡献1847条经验 获得超11个赞
<volist name='list1' id='vo'>
<tr id="row_{$vo.index}">
<td><img height=80px width=150px src="__PUBLIC__/goods/{$vo.img_address}" alt="13"></td>
<td>{$vo.goods_name}</td>
<td>{$vo.goods_describe}</td>
<td class='goodsprice'><strong>{$vo.goods_price}</strong></td>
<td><input type="number" class="myNumber" name="quantity" min="1" max="500" value='{$vo.goods_count}' onclick='myFunction("#row_{$vo.index}")'></td>
<td><strong id="allprice">{$vo.order_price}</strong></td>
<td><span class="red"><i class="fa fa-times" aria-hidden="true"></i></span></td>
</tr>
</volist>
<script>
function myFunction(rowIdSelector) {
var trRowDOM=document.getElementById(rowIdSelector);
var number = pareInt(trRowDOM.querySelector(".myNumber").value,10)||0;
var price= parseFloat(trRowDOM.querySelector(".goodsprice strong").innerText)||0.0;
var allprice=number*price+10;
document.getElementById("allprice").innerHTML = allprice.toFixed(2);
}
</script>
添加回答
举报