I just finished making an order form that now needs validation scripts. I'm fairly new to javascript so I'm not sure where to even start. I know that there free validation scripts on the internet, but there are not any that are specific to my needs. The main i开发者_StackOverflow中文版ssue is that I want my form to validate both US and international phone numbers and addresses. How can I go about doing this?
Thanks in advance for answering my amateur question!
Here is a small collection of how you can create small javascript functions to validate your form. I would suggest to look into Regular Expressions in Javascript
http://rgagnon.com/jsdetails/js-0063.html
How about the jQuery Validation Plugin I'v used it successfully.
...or the MooTools equivalent. Either way, it's worth using a framework rather than rolling your own. Internationalization is one of the things that it's best to avoid writing yourself if you can help it.
精彩评论