I am having trouble with one part of this assignment. I have everything else working but I can not get the checkDownfunction to properly check for an error. When I run the program, it always sends the alert. I assume it has something to do with this statement :

|| formData.downPayment.value > formData.stickerPrice.value)

especially the formData.stickerPrice.value portion. I thought that would work but it isn't.

I know this may not be the easiest way to do this, but the instructor wants it done this way. Here is the whole code to give you a better idea.

Any help would be appreciated.Code:<script type= "text/javascript"> <!-- function calcCost(formData) { //alert ("calcCost function reached."); //Input section var PRICE = parseFloat(formData.stickerPrice.value); var DOWN = parseFloat(formData.downPayment.value); var RATE = parseFloat(formData.interestRate.value); var TERM = parseInt(formData.termMonths.value,10); //calculations //alert (" calculating "); var PRIN = PRICE - DOWN; var INT = PRIN * (RATE/100) * TERM / 12; var TCOST = PRICE + INT; var MPAY = (PRIN + INT) / TERM; //output //alert("Output total calcuations reached"); formData.totalCost.value = "" + TCOST; formData.monthlyPayment.value = "" + MPAY; } function checkPrice(formData) { if (formData.stickerPrice.value < 0 || formData.stickerPrice.value > 100000 ) { alert("Sticker price must be greater than 0 or less than $100,000"); setTimeout (function() {formData.stickerPrice.focus();},3); } } function checkDown(formData) { if (formData.downPayment.value < 0 || formData.downPayment.value > formData.stickerPrice.value) { alert("Down Payment must be at least 0 but not greater than the sticker price."); setTimeout (function() {formData.downPayment.focus();},3); } } function checkRate(formData) { if (formData.interestRate.value < 0 || formData.interestRate.value > 25) { alert("Interest rate must be between 0% and 25%."); setTimeout (function() {formData.interestRate.focus();},3); } } function checkTerm(formData) { if (formData.termMonths.value < 0 || formData.termMonths.value > 72) { alert("The term of the loan should be between 0 and 72 months."); setTimout (function() {formData.termMonths.focus();},3); } } --> </script> </head> <body> <h1> Car Cost Calculator </h1> <hr /> <p> This program will determine and display the overall cost of purchasing a car and the monthly payment required. Please enter the following data without commas, dollarsigns or percent signs by filling in the fourinput text boxes below. Then click on the [Calcuate] button. The answer will appear in the two textboes at the bottom of the window. To calculate with different data, click the [Reset] button and start over.</p> <form action =''> <h2> INPUT AREA:</h2> <p>Sticker Price on the Car(in dollars): <input type="text" name="stickerPrice" onblur = "checkPrice(this.form)" /></p> <p>Down Payment(in dollars): <input type="text" name= "downPayment" onblur = "checkDown(this.form)"/></p> <p>Annual InterestRate of the Loan:% <input type="text" name ="interestRate" onblur = "checkRate(this.form)"/></p> <p>Term of the Loan (in Months): <input type="text" name ="termMonths" onblur = "checkTerm(this.form)"/></p> <p> <input type="button" value="Calculate" name="calcButton" onclick="calcCost (this.form)" /> <input type="reset" name="resetButton" value="Reset" /></p> <h2>OUTPUT AREA: </h2> <p>The total cost for that car including interest would be $ <input type ="text" name="totalCost" /></p> <p>The monthly payment would be $ <input type ="text" name = "monthlyPayment" /></p> </form> </body> </html>