Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var firstName = document.getElementById("name1").value;
- var age = document.getElementById("age").value;
- var secondName = document.getElementById("name2").value;
- var email = document.getElementById("email").value.indexOf("@");
- var phone = document.getElementById ("phone").value.indexOf("+");
- Submitted = "true";
- if (firstName.length > 15) {
- alert("The name must have no more than 15 characters!")
- Submitted = "false";
- }
- if (isNaN(age) || age < 10 || age > 120) {
- alert("The age must be between numbers 10 and 120!")
- Submitted = "false";
- }
- if (secondName.length > 15) {
- alert("The name must have no more than 15 characters!")
- Submitted = "false";
- }
- if (email.length > 200) {
- alert("The email must have no more than 200 characters!")
- Submitted = "false";
- }
- if (phone.length > 20) {
- alert("The phone number must have no more than 20 numbers!")
- Submitted = "false";
- }
- if (Submitted == "false") {
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement