开发者

Second alert not working

I have this function which calls values from document id's and some variables are defined.

It all seems to work fine besindes the variables already defined and the second alert box isnt appearing, any idea why?

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(parse开发者_JAVA技巧Float(val))) {
return 0;
}
return parseFloat(val);
}

Sorry I forgot to register...

I commented out the 'var EstimatedCoreHours = document.getElementById ("EstimatedCoreHours").value;' variable as it wasn't needed, Still doesn't work howerver...


You have

EstimatedCoreHours = 

but you alert:

EstimatedCoreHoursTotal

So, I'd guess you want to change:

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

to:

var EstimatedCoreHoursTotal =  GetNumeric(NoOfFrames) * GetNumeric(RenderHours) * GetNumeric(CoresInTest);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜