Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function validate_form()
- {
- valid = true;
- exampleregex = ""; //"get it from google"
- if (document.myForm1.example.value == "" ){
- alert ("Empty");
- valid = false;
- }
- else if (!(exampleregex.test(document.myForm1.example.value))) {
- alert("Bad Example");
- valid = false;
- }
- return valid;
- }
- </script>
- <form method="POST" name="myForm1" onsubmit="return validate_form()" action="">
- <input name="example" type="text"/>
- <input type="submit" value="Process"/>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement