Posted on 2007-07-23
The problem is that if user types 44444444444 in the text box, then I think the value is converting in string and does not compare properly.
but If it is small number like 77249.83, then it works fine.
var varPaymentRequired = '77249.83';
var varPayingAmount = '44444444444';
if(varPaymentRequired == varPayingAmount)
}else if(varPayingAmount >= varPaymentRequired)
alert("Amount is more than expected.");
I know that if we take variable like
var varPaymentRequired = 77249.83;
var varPayingAmount = 44444444444;
then it works fine, but the problem is that in text box if user type 44444444444' for variable varPayingAmount then this does not works fine.
In my actuall code, I have written the above 2 variables like this
var varPaymentRequired = document.Form1.<%=txtPaymentRequired.ClientID%>.value;
var varPayingAmount = document.Form1.<%=txtInvoicePayment.ClientID%>.value;
What is the prob?