amidude wrote on 10/1/2008 3:20 PM: 
> I've read over that and it's not helping much as it does very simple
> math. I'm not a math genius by any means. But that didn't look like it
> did anything other than add or subtract.
> 
> The math I need to calculate the BMI is a little more involved.

Well, I was thinking you could use parseNumber to convert the strings into 
numbers.  But you can do it manually too:

                $('#bmiCalc').bind('submit',function(event) {
                        var feet = parseFloat($('#feet').val(),10);
                        var inches = parseFloat($('#inches').val(),10);
                        var pounds = parseFloat($('#pounds').val(),10);

                        var totalInches = (feet * 12.0) + inches;

                        var bmi = Math.round(((pounds / (totalInches * 
totalInches)) * 703.0) * 10.0) / 10.0;
                        alert(bmi);
                });


That will return the correct BMI result.


- Bil

Reply via email to