我有以下函数应该产生一个名为"totalPrice"和"premPrice"的div的结果,但.innerhtml似乎没有出于某种原因将数字放在div中?您是否可以查看这段代码并告诉我为什么它不输入html的可能原因?由于我是网络语言的新手,你是否需要调用该函数?或者当我简单地定义它是被称为的函数?
HTML:
Yes
standard and premium system specs
JS:
function calculateTotal()
{
var boilerPrice = getBoilerSizePrice() + getBedroomSizePrice() + getBathroomSizePrice() + getTankSizePrice() ;
//display the result
var divobj = document.getElementById('totalPrice');
divobj.style.display='block';
divobj.innerHTML = "Your New Boiler Install Price is £"+boilerPrice;
var divobj = document.getElementById('premPrice');
divobj.style.display='block';
divobj.innerHTML = "Premium price £"+((boilerPrice/100)*120);
}