Ver Mensaje Individual
  #38 (permalink)  
Antiguo 03/12/2012, 17:03
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 12 años, 5 meses
Puntos: 10
Respuesta: No me lleva a la pagina.

Cita:
Iniciado por jmdearpe Ver Mensaje
Código HTML:
function GuardaFormulario()
{
    var TELEFONO = document.forms['form1'].elements['TELEFONO'];
    if (TELEFONO.value.length == 0)
    {
		
        alert("Insertar el Teléfono");

        TELEFONO.focus();

        return 0;

    }
    else
    {
		if (window.XMLHttpRequest)
		{
			xmlhttp=new XMLHttpRequest();
		}
		else
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}	
		xmlhttp.open("GET", "valida1.php?TELEFONO=" + TELEFONO.value, false);
		xmlhttp.send();	   

        if (xmlhttp.readyState==4 && xmlhttp.status==200)      
        {
            var xml = xmlhttp.responseXML;
            dato=xml.getElementsByTagName("datos");
            if(dato[0].firstChild.nodeValue=="1")
            {
                num_user=xml.getElementsByTagName("numusuario");
                if (confirm("¡Usuario existente!¿Desea hacer un nuevo registro?"))
                { 
                   document.forms['form1'].action = location.protocol+'//'+location.hostname+"/"+"menu3.php?id="+num_user[0].firstChild.nodeValue;		
			    } 
                else 
                { 
				    document.forms['form1'].action = location.protocol+'//'+location.hostname+"/"+"menu4.php";  
                }
            }
            if(dato[0].firstChild.nodeValue=="0")
            {                   
                                alert("¡El Cliente se ha dado de alta!");
				document.forms['form1'].submit();////Aquí mando el formulario si el teléfono no existe.
            } 
        }

    }
} 
Hola mira a ver así...

salu2 ;)
Vale, esto va mejor ya si me hace el:
if (confirm("¡Usuario existente!¿Desea hacer un nuevo registro?"))
Pero cuando le doy a aceptar no me lleva a menu3.php.
Y otra cosa no quiero que me mande el form1, nada mas que al final en:
document.forms['form1'].submit();////Aquí mando el formulario si el teléfono no existe.
Gracias por tú esfuerzo de verdad. Si pudieras comentar un poco los cambios.