Image

Why this this failing???

This is for a currency field (num). The value should always be in the form of "$" + a two-decimal floating number. (eg: $24.00, not $24)

var amt = parseFloat(num.substring(1,num.length))
if (isNaN(amt) || amt.toString() != num.substring(1,num.length))
     if (isNaN(amt)) alert('Not a Number!');
     if (amt.toString() != num.substring(1,num.length))
         alert ('Value Entered: ' + num.substring(1, num.length));
         alert ('Number Value: ' + amt);
         alert ('String Value: ' + amt.toString());
     return false;


When I run the script, I keep hitting the if (amt.toString() != num.substring(1,num.length)) condition, even when the Value Entered, the Number Value, and the String Value are all the same.