是我的脚本来计算总..javascript代码,以显示内部tetxbox DIV消息下面
<script type="text/javascript" >
function calculateTotal() {
// price per unit
var priceEL = document.getElementById('price');
// get input element from DOM
var inputEl = document.getElementById('quantity');
// read quantity from the input element (it is read as a string)
var priceSting = priceEL.value;
var quantitySting = inputEl.value;
// convert string value from the form element into integer (or float if needed)
var quantity = parseInt(quantitySting);
var price = parseInt(priceSting);
// calculate total
var total = price * quantity;
// get element that displays total from DOM
var displayEl = document.getElementById('total')
// display total value in target element
displayEl.innerHTML = total;
}
</script>
现在我的代码回声div标签内总价值......像下面
<div id ="total"></div>
我需要在文本框下方显示总数....
<input type="textbox" name="total" id ="total"></td>
这让我想起了几次,值应该工作 – Izion