var userEmail = document.getElementById("username"),
userPass = document.getElementById("pass")
var regexp = new RegExp("^([a-z0-9_-]+\.)*[a-z0-9_-]+@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.[a-z]{2,6}$");
var regexpP = new RegExp("^[a-zA-Z0-9!@#$%^&*]{6,16}$");
function validate() {
var result = false;
if(!regexp.test(userEmail.value)) {
userEmail.style.border = "2px solid red";
result = false;
alert('Некорректно введен Email!')
} else {
userEmail.style.border = "2px solid green";
result = true;
}
if(!regexpP.test(userPass.value)) {
userPass.style.border = "2px solid red";
result = false;
alert('Некорректно введен Пароль!')
} else {
userPass.style.border = "2px solid green";
}
return result;
}