error_nombre="name is a mandatory field"; error_email="email is a mandatory field"; error_aviso="You must accept the terms and conditions"; var expr_noemail = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(www\.)|(WWW\.)/; var expr_email = /^[a-zA-Z0-9._\-']+@[a-zA-Z0-9._\-]+\.[a-zA-Z]{2,4}$/; function comprobaciones_contacto() { var forms = document.getElementsByTagName('form'); var formulario = forms[0]; document.getElementById('Nombre').className ="caja_form"; document.getElementById('Email').className ="caja_form"; if (formulario.Nombre.value.length == 0) { //document.getElementById("errores").innerHTML=error_nombre; document.getElementById('Nombre').className ="caja_form_error"; formulario.Nombre.focus(); return false; } if (expr_noemail.test (formulario.Email.value) || !expr_email.test (formulario.Email.value)) { //document.getElementById("errores").innerHTML=error_email; document.getElementById('Email').className ="caja_form_error"; formulario.Email.focus(); return false; } if (!formulario.check_aviso.checked) { document.getElementById('check_aviso').className ="caja_form_error"; alert(error_aviso); formulario.check_aviso.focus(); return false; } formulario.submit(); }