I have a form which runs some javascript code upon submission to check the validity of the data.
In one instance, I have a min, target and max value. min should always be less than target and target should always be less than max. These values are inputted into a text box.
I used the following if statement to catch any logical inconsistencies:
[CODE]if ((document.tForm.minH.value >= document.tForm.targetH.value) || (document.tForm.targetH.value >= document.tForm.maxH.value))
{
}
I believe the issue I’m having is that these values are being compared alpha-numerically, not numerically. If I type in 1, 2 and 3 respectively, it will pass. However, if I type in 1, 2 and 100000, it will not, because 100000 is being labeled as less than 2.
Do I have to convert these values to numbers (if so, how do you do that?), or is there a way to compare them as numbers? Or am I entirely missing the issue?
Thanks for any help.