Валидация формы
[JS]function validate() {
var userEmail = document.getElementById("username");
var userPas = document.getElementById("pas");
var regexp = new RegExp("^([a-z0-9_-]+\.)*[a-z0-9_-]+@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.[a-z]{2,6}$");
if(userEmail.value != regexp) {
userEmail.style.border = "2px solid red";
return false;
}
if(userPas.value = "") {
userPas.style.border = "2px solid red";
return false;
}
return true;
}[JS]
|