In other words if the first condition fails, the second condition will not be tested and so forth.

javascript for validating web site address-54javascript for validating web site address-7javascript for validating web site address-51

Some may wonder why a Regular Expression wasn't used.

It's because parsing an IP address is just as simple, if not simpler, with string manipulation functions than with a complicated regular expression because of its uniform and constant format (4 numbers separated by 3 dots).

Do you need a quick function to perform simple validation for a version 4 IP Address?

Well, the function below should be able to do that for you.

If you're working with arrays of checkboxes to submit data to a server-side script then you might already have some grey hairs from trying to figure out how to validate the input using Java Script.

The problem is that, to have the data submitted in a 'nice' format to the server, the function returns an array containing all the selected checkbox values. In more complicated forms you will want to set conditions on the form that combine multiple elements.First of all, let me tell you what it does and what it doesn't do: If you want the function do anything that I said it doesn't do, then you will have to add that in there yourself. I will explain what it does and how you can modify it to fit your needs.But first, here's the function itself: First, a quick explanation of what the function does and how it works.I tested your first piece of code on a form and it does not work at all.Tried setting it up on onsubmit on both form and button and no go.You'll see that the all validation scripts presented on this and subsequent pages adhere to the same basic format.