JavaScript question re: calculating BMI
I am by no means a programmer but I've been fooling around with JavaScript a little and had enough success to whet my appetite. So I thought this would be a fairly simple problem.
I have a couple of text entry boxes, one of which has a variable, v_Ht and the other which has a variable, v_Wt associated with it. When a slide enters, I want the BMI to appear in a text caption. Here is the JavaScript I've attached to On Enter for that slide:
Height = window.cpAPIInterface.getVariableValue('v_Ht');
Weight = window.cpAPIInterface.getVariableValue('v_Wt');
Kiloweight = Weight * 0.45;
HeightMeters = Height * 0.025;
HeightMetersSquared = HeightMeters * HeightMeters;
BMI = Kiloweight / HeightMetersSquared;
window.cpAPIInterface.setVariableValue('v_BMI', BMI);
I have created a Captivate variable for BMI as well (v_BMI). What's appearing in the text caption is NaN, which I believe means that the result is not a number. I'm really puzzled as to why I'm getting this result when I followed a similar procedure (successfully) to calculate tax and a discount on a product.
