isNaN function jscript

Discussion in 'ASP .Net' started by =?Utf-8?B?c2lhag==?=, Mar 8, 2005.

  1. 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
     
    =?Utf-8?B?c2lhag==?=, Mar 8, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?c2lhag==?=

    Riki Guest

    "siaj" <> wrote in message
    news:...
    > 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
     
    Riki, Mar 8, 2005
    #2
    1. Advertising

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

    BTW am I right using isNaN for IsNumeric requirement..

    cheers,
    siaj

    "siaj" wrote:

    > 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
     
    =?Utf-8?B?c2lhag==?=, Mar 8, 2005
    #3
  4. =?Utf-8?B?c2lhag==?=

    Guest

    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.
     
    , Mar 8, 2005
    #4
  5. Yeah the problem got solved....
    siaj



    "" wrote:

    > 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.
    >
    >
     
    =?Utf-8?B?c2lhag==?=, Mar 8, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Maz
    Replies:
    4
    Views:
    1,273
    Jon Maz
    Sep 9, 2004
  2. Maxwell2006
    Replies:
    5
    Views:
    2,395
    Steven Cheng[MSFT]
    Mar 7, 2006
  3. Christopher Benson-Manica
    Replies:
    0
    Views:
    426
    Christopher Benson-Manica
    May 11, 2004
  4. John Bentley
    Replies:
    14
    Views:
    352
    Jim Ley
    Feb 5, 2004
  5. VK
    Replies:
    4
    Views:
    356
    Thomas 'PointedEars' Lahn
    Jan 12, 2006
Loading...

Share This Page