我想顯示在HTML中,某些整數值JavaScript,但不幸的是這兩個.html和的.text不工作.html和的.text沒有工作
這裏是我的代碼
<script type="text/javascript">
$(".total").text("<?php echo $row_price['product_price'] + $economy; ?>");
$('input:radio[name="shipping_type"]').change(function(){
if($(this).val() == "economy"){
$(".total").text("<?php echo $row_price['product_price'] + $economy; ?>");
}else{
$(".total").text("<?php echo $row_price['product_price'] + $fast; ?>")
}
});
</script>
通過檢查源代碼值在.text()函數成功到來。沒有錯誤在控制檯上顯示,以及 HTML
<tr>
<td class='radio-container'>
<input checked="checked" id="shipping_type_economy" name="shipping_type" type="radio" value="economy" />
</td>
<td><label for="shipping_type_domestic">Economy</label></td>
<td class='right'>
<span class="economy">10.20$</span>
</td>
</tr>
<tr>
<td class='radio-container'>
<input id="shipping_type_fast" name="shipping_type" type="radio" value="fast" />
</td>
<td><label for="shipping_type__fast">Fast</label></td>
<td class='right'>
<span class="fast">20.00$</span>
</td>
</tr>
<tr><td>TOTAL</td>
<td class="right" id="total"><span class="total"><span/></td>
</tr>
是在服務器端運行PHP的一部分? – Leo 2014-12-06 08:04:04