isNaN function jscript

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to jscript..
I am trying to validate if a textbox on my ASP.NET page has numeric value..
The code I am using is

function IsValidAmount()
{
var intTotalAmt = document.Form1.txtTotalAmt.value;
If (isNaN(intAmt1)== false)
{//do something}
}

I am getting a Object Expected error at the If Condition. can someone guide
me on the same...
Also Is it is OK using the isNaN function for Numeic validation as I have
seen people writing there own custom IsNumeric Function for the purpose.

cheers,
siaj
 
siaj said:
I am new to jscript..
I am trying to validate if a textbox on my ASP.NET page has numeric value..
The code I am using is

function IsValidAmount()
{
var intTotalAmt = document.Form1.txtTotalAmt.value;
If (isNaN(intAmt1)== false)
{//do something}
}

I am getting a Object Expected error at the If Condition. can someone guide
me on the same...
Also Is it is OK using the isNaN function for Numeic validation as I have
seen people writing there own custom IsNumeric Function for the purpose.

cheers,
siaj

if should be written in lower case.

Riki
 
Tanks Riki..
I m just kicking mself...

BTW am I right using isNaN for IsNumeric requirement..

cheers,
siaj
 
was the problem solved?
If not you should probably check your document.Form1.controlname and
make sure that everything is kosher there.
you should also probably try document.forms[0].controlname as I believe
this is more cross-browser friendly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top