我正在尝试制作一个小计计算工具,但我无法继续,因为我不知道问题出在哪里。提交表单或单击按钮时,一切都会很快消失。
这是小提琴 :: http://jsfiddle.net/xFmBK/
我一无所知...
function calcSub(){
var input = document.getElementById('fld'),
subTotal = document.getElementById('sub-total'),
tax = document.getElementById('tax'),
total = document.getElementById('total');
var subTotalCalc = input.value / 1.06;
var flag = true;
if(input.value == "" || input.value == null){
alert("Please enter in a total!");
return false;
} else {
subTotal.innerHTML = "Subtotal:" + " " + "$" + subTotalCalc;
tax.innerHTML = "Tax:" + " " + "$" + input.value - subTotalCalc;
total.innerHTML = input.value;
return flag;
}
}