473,413 Members | 1,795 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,413 software developers and data experts.

javascript for a textbox to accept the values in decimals and within range

23
Hi,
Plz provide me javascript :

javascript for a textbox to accept the values in decimals and within range

i need to enter a value in textbox like 1.03 and it should be <3 (lessthan 3).

Plz help me.

Rgds,
Nussu
Nov 16 '07 #1
7 6807
Dasty
101 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. function check(value)
  2. {
  3.   if (/^[0-9]*(\.[0-9]{1,2})?$/.test(value))
  4.   {
  5.     if (parseFloat(value) < 3.0)
  6.     {
  7.       return true;
  8.     }
  9.   }
  10.   return false;
  11. }
It will check for none up to 2 decimal places. If you want to accept more, just change "2" in regular expression to higher number. This function returns true if value is ok, otherwise false.
Nov 16 '07 #2
nussu
23
Thnx Dasty,

It is working fine now.
Nov 16 '07 #3
nussu
23
Hi,

A textbox has to accept only numeric values using javascript in .net 2.0

Once i comeout of textbox and if it is not numeric value i have to get alert.

Plz provide me complete code ..

code in textbox and as well as javascript function.

I am new to .net plz help me...

Plz help me ...

Regards,
Nussu
Nov 18 '07 #4
gits
5,390 Expert Mod 4TB
hi ...

you might have a look at this thread ...

kind regards
Nov 18 '07 #5
Markus
6,050 Expert 4TB
Hi,

A textbox has to accept only numeric values using javascript in .net 2.0

Once i comeout of textbox and if it is not numeric value i have to get alert.

Plz provide me complete code ..

code in textbox and as well as javascript function.

I am new to .net plz help me...

Plz help me ...

Regards,
Nussu
Don't be so cheeky and read a tutorial.
Nov 18 '07 #6
nussu
23
Hi,

I need a javascript for a textbox to accpet only decimal values( i.e as 0.005) and
if it is < 0.005 i need to raise an alert.

Help me plz

Regards,
Nussu
Nov 26 '07 #7
acoder
16,027 Expert Mod 8TB
I've merged your threads yet again. Keep all posts on one topic in one thread. This is your final warning.
Nov 26 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.