473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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.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
Nov 19 '05 #1
4 4535

"siaj" <si**@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.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.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
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.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

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****@community.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
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...
26
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...
5
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...
2
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. ...
17
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...
2
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...
7
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...
6
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...
4
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.