473,799 Members | 2,936 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

isNaN function jscript

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.val ue;
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
Nov 19 '05 #1
4 4552

"siaj" <si**@discussio ns.microsoft.co m> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
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.val ue;
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
Nov 19 '05 #2
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.val ue;
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

Nov 19 '05 #3
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.

Nov 19 '05 #4

Yeah the problem got solved....
siaj

"re****@communi ty.nospam" 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.

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
4215
by: chirs | last post by:
I am trying to understand a piece of code. In a javascrpit file, there is a function: function ItemStyle(){ var names=; addProps(this,arguments,names,true); }; In the html file, it calls the function as:
26
10816
by: Roland Hall | last post by:
I'm tired of getting beat up on this issue so I thought I'd ask what you some of you think. I know the basic difference between a subroutine and a function is a subroutine performs a task and a function performs a task and returns a value. The Call keyword is required when using parens with subs with more than 1 parameters. Parens around values passed are ByVal vs ByRef and is a waste of processing if passed ByRef for no reason. I...
5
15642
by: Skybuck Flying | last post by:
Hi, I have one more remaining "problem" with compiling a unix source code for windows/visual c/c++ 6.0 What does the isnan routine do ? Documentation says it checks for NaN ? What does that mean ? What is a good replacement for Visual C/C++ 6.0 ?
2
3053
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. Furthermore I know there will be a postback involved but the state of the page will not change at all so I would like it to be as efficient as possible with no appearance to the user that anything happened. I saw in someone else's code where...
17
2024
by: Matt Kruse | last post by:
Perl's map() function is a powerful shortcut to accomplish many "loop over an array and do X" operations. Below is a quick hack to simulate similar functionality. I've used it a few times and find it to be quite handy. Any thoughts? <script type="text/javascript"> function map(func) { var i,j,o; var results = ;
2
49866
by: Priya | last post by:
Halo. I am using isinf() & isnan() in my code, and i get an error error LNK2001: unresolved external symbol "int __cdecl isnan(double)" (?isnan@@YAHN@Z) my code is the implementation of LambertW function #include <math.h>
7
3226
by: VK | last post by:
I was getting this effect N times but each time I was in rush to just make it work, and later I coudn't recall anymore what was the original state I was working around. This time I nailed the bastard so posting it before I forgot again... By taking this minimum code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head>
6
5588
by: Java script Dude | last post by:
Small glitch (IMHO) in JavaScript is related to isNaN() boolean function. If passed a null, it returns true which is incorrect. This one cause me quite a bit of grief until I detected it and was able to code around it. Anybody know the reasoning for the result being false and not true for isNaN(null). - JsD
4
4294
by: jacob navia | last post by:
Hi Has C++ defined the function isnan() for complex numbers? What is the definition? Thanks in advance -- jacob navia jacob at jacob point remcomp point fr
0
9686
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.