Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Javascript-Check IP Address using Regex
WhatsApp
Ghanashyam Nayak
4y
34.8
k
0
0
25
Blog
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
>
<html>
<head>
<title>Sample Code</title>
<script type=
"text/javascript"
>
function
CheckIPAddress(MyIPAddress)
{
var
CheckIP = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
if
(CheckIP.test(MyIPAddress))
{
alert(
"Your IP Address Is Valid."
);
}
else
{
alert(
"Your IP Address Is Not Valid."
);
}
}
</script>
</head>
<body bgcolor=#00ff00 alink=blue vlink=blue>
<FORM name=
"windowEvent"
>
IP Address : <input type=
"text"
name=
"txtipaddress"
/>
<input type=
"button"
value=
"Check"
name=
"btnIPAddress"
onClick=
"CheckIPAddress(txtipaddress.value)"
/>
</FORM>
</body>
</html>
Javascript-Check IP Address using Regex
Up Next
How to Get Client IP Address Or Local IP Address In JavaScript
Ebook Download
View all
Frontend Developer Interview Questions and Answers
Read by 938 people
Download Now!
Learn
View all
Membership not found