W
Window Frog
Hello gurus... I must have looked at this too long and something
simple has stopped making sense. I am trying to compare 2 numbers to
each to check if one is >= to the other, but the weirdest thing keeps
happening. If the number is any more than 1 digit it does not work.
For example, the script sees 12 as being smaller than 7 because (it
seems) it's only comparing the first digit. Below is the function that
is doing the checking. Any thoughts? Thanks all.
<script language="javascript">
function checkTest()
{
var error_string = "";
if (window.document.form.iPrice2.value >=
window.document.form.iPrice1.value)
{
error_string += "NO 1.\n";
}
if (window.document.form.iPrice3.value >=
window.document.form.iPrice2.value)
{
error_string += "NO 2.\n";
}
if (window.document.form.iPrice3.value == "")
{
error_string += "NO 3.\n";
}
if (error_string == "")
{
return true;
} else {
error_string = "Check the form and complete the following:\n" +
error_string;
alert(error_string);
return false;
}
}
</script>
simple has stopped making sense. I am trying to compare 2 numbers to
each to check if one is >= to the other, but the weirdest thing keeps
happening. If the number is any more than 1 digit it does not work.
For example, the script sees 12 as being smaller than 7 because (it
seems) it's only comparing the first digit. Below is the function that
is doing the checking. Any thoughts? Thanks all.
<script language="javascript">
function checkTest()
{
var error_string = "";
if (window.document.form.iPrice2.value >=
window.document.form.iPrice1.value)
{
error_string += "NO 1.\n";
}
if (window.document.form.iPrice3.value >=
window.document.form.iPrice2.value)
{
error_string += "NO 2.\n";
}
if (window.document.form.iPrice3.value == "")
{
error_string += "NO 3.\n";
}
if (error_string == "")
{
return true;
} else {
error_string = "Check the form and complete the following:\n" +
error_string;
alert(error_string);
return false;
}
}
</script>