Я уже нашла такой метод но как реализовать его под мой код не понимаю,поможете?
function Go(Form){
var text = [4];
text[0] = document.getElementById("1");
text[1] = document.getElementById("2");
text[2] = document.getElementById("3");
text[3] = document.getElementById("4");
var mt = [4];
for (let i = 0; i < 4; i++){mt[i] = false}
if(Form.tl.value != ""){
let n = 0;
for (let i = 0; i < Form.tl.value.length; i++){
if(Form.tl.value[i] >= 'a' && Form.tl.value[i] <= 'z'){n++}else{n = 0; break;}
}
if(n >= 4 && n <= 8){
mt[0] = true;
}
}
if(Form.te.value != ""){
let i = 0, n = 0;
for (; i < Form.te.value.length && Form.te.value[i] != '@'; i++){
if(Form.te.value[i] >= 'A' && Form.te.value[i] <= 'Z' || Form.te.value[i] >= 'a' && Form.te.value[i] <= 'z' || Form.te.value[i] >= '0' && Form.te.value[i] <= '9' || Form.te.value[i] == '.' && n != 0 && Form.te.value[i+1] != '@'){n++}
else {n = 0; break;}
}
if(n >= 2){
n = 0;
i++;
for (; i < Form.te.value.length && Form.te.value[i] != '.'; i++){
if(Form.te.value[i] >= 'a' && Form.te.value[i] <= 'z'){n++}
else {n = 0; break;}
}
if(n >= 1){
i++;
let str = "";
for (; i < Form.te.value.length; i++){
str += Form.te.value[i];
}
if(str == 'ua' || str == 'com' || str == 'ru' || str == 'ch' || str == 'cz' || str == 'net' || str == 'edu.ua'){mt[1] = true}
}
}
}
if(Form.tp1.value != ""){
let n = 0;
let n1 = 0;
let n2 = 0;
for (let i = 0; i < Form.tp1.value.length; i++){
if(Form.tp1.value[i] >= 'A' && Form.tp1.value[i] <= 'Z'){n++}
if(Form.tp1.value[i] >= 'a' && Form.tp1.value[i] <= 'z'){n1++}
if(Form.tp1.value[i] >= '0' && Form.tp1.value[i] <= '9' ){n2++}
}
let n3 = Form.tp1.value.length - n - n1 - n2;
if(n >= 1 && n1 >= 1 && n2 >= 1 && n3 >= 1 && Form.tp1.value.length >= 8){mt[2] = true}
}
if(Form.tp2.value == Form.tp1.value && Form.tp2.value != ""){mt[3] = true}
let m = 0;
for (let i = 0; i < 4; i++){
if(mt[i] == false){
text[i].style.color = 'red';
}
else { text[i].style.color = 'rgb(132, 170, 221)'; m++}
}
t = document.getElementById("t");
if(m == 4){
t.innerHTML = "регистрация прошла успешно";
}
else{t.innerHTML = "";}
}