Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-16-2009, 11:41 AM   PM User | #1
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 799
Thanks: 211
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
Question jQuery IP Validator

Hi

I was wondering if its possible to check an IP address format with this jQuery plugin?

http://digitalbush.com/projects/mask...-plugin/#usage

If yes, how? If not, is there any other jQuery Plugin for it?

Thanx in advance
cancer10 is offline   Reply With Quote
Old 02-16-2009, 11:55 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
I don't see why not (but you could try it out!).

Or use this:-


Code:
<script type = "text/javascript">
var ip = "129.31.1.10";
var valid = true;
var ipsub = new Array();
ipsub = ip.split(".");
for (var i = 0; i <ipsub.length; i++) {
var sub = parseInt(ipsub[i]);
if ((isNaN(sub)) || (sub <0) || (sub >255)) {
valid = false;
}
}

alert (valid);
</script>

"Very unusually it has turned noon here in Newcastle." - Football Commenator
Philip M is offline   Reply With Quote
Old 02-16-2009, 01:54 PM   PM User | #3
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 799
Thanks: 211
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
That does not validate 192.168.0.1

It says invalid IP
cancer10 is offline   Reply With Quote
Old 02-16-2009, 04:32 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by cancer10 View Post
That does not validate 192.168.0.1
It says invalid IP
Well, it returns true (= valid) for me.
Philip M is offline   Reply With Quote
Old 02-16-2009, 04:34 PM   PM User | #5
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 799
Thanks: 211
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
Oh Yes you are right. I was missing something....

Thanx so much for your kind help
cancer10 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:12 AM.


Advertisement
Log in to turn off these ads.