Scott
Scott

Reputation: 1

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(parseFloat(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...

Upvotes: 0

Views: 93

Answers (1)

ADW
ADW

Reputation: 4080

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);

Upvotes: 2

Related Questions