C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Check the Validation for floating point numbers in HTML
WhatsApp
Ghanashyam Nayak
5y
36.4
k
0
0
25
Blog
<html>
<head>
<title>Sample Code</title>
<script type=
"text/javascript"
>
function
CheckFloatingPoint(ValueNumeric)
{
var
objRegex = /(^-?\d\d*\.\d\d*$)|(^-?\.\d\d*$)/;
//check for numeric characters
if
(objRegex.test(ValueNumeric))
{
alert(
"Your Given Input \""
+ValueNumeric+
"\" Is Correct."
);
}
else
{
alert(
"Your Given Input\""
+ValueNumeric+
"\" Is Not Correct."
);
}
}
</script>
</head>
<body bgcolor=#00ff00 alink=blue vlink=blue>
<FORM name=
"windowEvent"
>
Number : <input type=
"text"
name=
"txtnumber"
/>
<input type=
"button"
value=
"Check Floating Point"
name=
"btnCheckFloatingPoint"
onClick=
"CheckFloatingPoint(txtnumber.value)"
/>
</FORM>
</body>
</html>
Check The Validation For Only Floating Point Number
Recommended related topics
Membership not found