Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkFields(text1, text2, text3) {
- var pattern = /495|632/;
- var isCorrect = true;
- if (text1.search(pattern) == -1) {
- isCorrect = false;
- }
- pattern = /d{3}/;
- if (text2.search(pattern) == -1) {
- isCorrect = false;
- }
- pattern = /d{4}/;
- if (text3.search(pattern) == -1) {
- isCorrect = false;
- }
- if (isCorrect) {
- alert("Спасибо за заказ!");
- } else {
- alert("Неправильный ввод!");
- }
- }
- function checkFields(text1,text2,text3){
- return alert(
- (text1.search(/495|632/) != -1 &&
- text2.search(/d{3}/) != -1 &&
- text3.search(/d{4}/) != -1)
- ?"Спасибо за заказ!"
- :"Неправильный ввод!"
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement