Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/07/2008, 12:00
juandedios
 
Fecha de Ingreso: mayo-2003
Ubicación: Lima
Mensajes: 967
Antigüedad: 23 años, 5 meses
Puntos: 8
Creo que hay un problema con mi script

No se donde podra estar el error, antes siempre lo hacia asi, pero si no funciona es obvio que hay error, pero no me sale ningun tipo de error, siemplemente no hace nada.

Aqui esta la parte del HTML:
Código PHP:
<input type = "text" name = "email" id = "email" size = "50" />
<
img src = "img/start.png" border = "0" alt = "Requerido" width = "15" height = "15" />
<
a href = "javascript:ComprobarEmail();">Comprobar</a> 
El script esta aqui:
Código PHP:
function nuevoAjax(){

    var 
xmlhttp=false;
    
    try {
        
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (
e) {
        try {
            
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (
E) {
            
xmlhttp = false;
        }
    }

    if (!
xmlhttp && typeof XMLHttpRequest!='undefined') {
        
xmlhttp = new XMLHttpRequest();
    }
    
    return 
xmlhttp;
}

function 
isEmailCorrecto(email) {

    var 
filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+.[A-Za-z0-9_.]+[A-za-z]$/;
    if (
email.length == 0 ) return true;
       if (
filter.test(email))
          return 
true;
       else
         
alert("Ingrese una dirección de correo válida");
    return 
false;

}

function 
ComprobarEmail() {

    var 
cEm = document.getElementById("email");
    var 
vEm = cEm.value;
    
    if (
trim(vEm) == "") {
        
alert("Ingrese un correo electrónico válido.";
        return 
false;
    }
    else {
        if (
isEmailCorrecto(vEm)) {
            
cEm.value = "Comprobando...";
            
cEm.disabled = true;
            
            
ajax = nuevoAjax();
            
ajax.open("GET", "../php/function.php?vEmail="+vEm, true);
            
ajax.onreadystatechange = function() {
                if (
ajax.readyState == 4) {
                    
alert(ajax.responseText);
                }
            }
            
            
ajax.send(null)
        }
    }
} 
__________________
El aprendiz.