Javascript 第二个警报不起作用

Javascript 第二个警报不起作用,javascript,Javascript,我有一个函数,它调用文档id中的值,并定义了一些变量 这一切似乎都很好,因为变量已经定义,第二个警报框没有出现,你知道为什么吗 function Calculate() { var ContentMinutes = document.getElementById ("ContentMinutes").value; var NoOfFrames = 5; var EstimatedCoreHours = document.getElementById ("EstimatedCoreHours").

我有一个函数,它调用文档id中的值,并定义了一些变量

这一切似乎都很好,因为变量已经定义,第二个警报框没有出现,你知道为什么吗

function Calculate() {
var ContentMinutes = document.getElementById ("ContentMinutes").value;
var NoOfFrames = 5;
var EstimatedCoreHours = document.getElementById ("EstimatedCoreHours").value;
var ServiceLevel=document.getElementById('SerivceLevelDD').options[document.getElementById('SerivceLevelDD')    .selectedIndex].value
var RenderHours = 1;
var CoresInTest = 2;

var EstimatedTotal =  GetNumeric(ServiceLevel) * GetNumeric(EstimatedCoreHours);
alert('hi = '+EstimatedTotal.toFixed(2));

var EstimatedCoreHours =  GetNumeric(NoOfFrames) * GetNumeric(RenderHours) * GetNumeric(CoresInTest);
alert(' = '+EstimatedCoreHoursTotal.toFixed(2));
}

function GetNumeric(val) {

if (isNaN(parseFloat(val))) {
return 0;
}
return parseFloat(val);
}

对不起,我忘了注册

我注释掉了'var estimatedcorhours=document.getElementById(“estimatedcorhours”).value;'变量,因为它不是必需的,但是仍然不起作用…

EstimatedCoreHours = 
但你要注意:

EstimatedCoreHoursTotal
所以,我猜你想要改变:

var EstimatedCoreHours =  GetNumeric(NoOfFrames) * GetNumeric(RenderHours) * GetNumeric(CoresInTest);
致:


我冒昧地合并了你的两个账户,并保留了一个有问题的账户。
var EstimatedCoreHoursTotal =  GetNumeric(NoOfFrames) * GetNumeric(RenderHours) * GetNumeric(CoresInTest);