Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Duda De Compatibilidad Entre Navegadores Con Ajax

Estas en el tema de Duda De Compatibilidad Entre Navegadores Con Ajax en el foro de Frameworks JS en Foros del Web. HOLA AMIGOS, TENGO EL SIGUIENTE PROBLEMA : HICE UNA PAGINA WEB Y UN PEQUEÑO FORM CON UN TEXT PARA COLOCAR EL NICK O NOMBRE Y ...
  #1 (permalink)  
Antiguo 03/05/2007, 16:24
 
Fecha de Ingreso: mayo-2007
Ubicación: ibague - tolima
Mensajes: 8
Antigüedad: 17 años
Puntos: 0
Duda De Compatibilidad Entre Navegadores Con Ajax

HOLA AMIGOS, TENGO EL SIGUIENTE PROBLEMA :


HICE UNA PAGINA WEB Y UN PEQUEÑO FORM CON UN TEXT PARA COLOCAR EL NICK O NOMBRE Y UN TEXTAREA PARA EL COMENTARIO; PASA QUE AL PROBARLO LOCALMENTE FUNCIONA BIEN , USO FIREFOX 2, Y CON IE TAMBIEN FUNCIONA, PERO CON FIREFOX 1.5,, NO ME ENVIA UN ERROR ASI :

t1 = document.getElementById('nick1').value has not propiertes;

Y SE SALE DEL SCRIPT AJAX DE UNA, EXTRAÑO, POR QUE EN FIREFOX 2 SALE EL MISMO ERROR , PERO SI ENVIA EL COMENTARIO.

AQUI LES PRESENTO EL CODIGO DEL FORM :


<center>
<FORM NAME="miFormu" ACTION=" " onSubmit="enviar('insertar_comentario.php','mensaj e','POST'); return false; " >

Nick : <INPUT TYPE="text" name="nick1" SIZE=20 MAXLENGTH=20 >
<BR>
<TEXTAREA COLS=60 ROWS=10 name="comentario">
</TEXTAREA>
<BR>
<INPUT TYPE="submit" VALUE="Enviar Comentario" >
<INPUT TYPE="reset" VALUE="Borrar Comentario" >

</FORM>
</center>



Y AQUI ESTA EL SCRIPT AJAX :



function creaAjax(){
var objetoAjax=false;
try {
/*Para navegadores distintos a internet explorer*/
objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
/*Para explorer*/
objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
objetoAjax = false;
}
}

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


//********************************************* FUNCION QUE ENVIA LOS DATOS ********************************************

function FAjax (url,capa,metodo){

var ajax=creaAjax();
var capaContenedora = document.getElementById(capa);

if(metodo.toUpperCase()=='GET'){

ajax.open ('GET', url,true);

ajax.onreadystatechange = function() {

if (ajax.readyState==1) {
capaContenedora.innerHTML="Cargando.......";
capaContenedora.innerHTML= '<br><br><br><br> <center> <img src="images/loader.gif"> </center>';

}else
if (ajax.readyState==4){

if(ajax.status==200){
document.getElementById(capa).innerHTML=ajax.respo nseText;

}else
if(ajax.status==404){
capaContenedora.innerHTML = "La direccion no existe";

}else {
capaContenedora.innerHTML = "Error: ".ajax.status;
}
}
}

ajax.send(null);
return;

}

}



//********************************************* FUNCION QUE ENVIA LOS DATOS ********************************************

function enviar(url,capa,metodo){

var ajax=creaAjax();
var capaContenedora = document.getElementById(capa);
var t1, t2;
t1 = document.getElementById('nick1').value;
t2 = document.getElementById('comentario').value;


if (t1.length <=0) {
alert('DEBE COLOCAR UN NOMBRE O NICK')
document.getElementById('nick1').focus();
return;

}else
if (t2.length <=0) {
alert('DEBE COLOCAR UN COMENTARIO')
document.getElementById('comentario').focus();
return;

}else{

if(metodo.toUpperCase()=='POST'){

ajax.open ('POST', url,true);
ajax.onreadystatechange = function() {

if (ajax.readyState==1) {
capaContenedora.innerHTML="Cargando.......";
capaContenedora.innerHTML= '<img src="../images/loader.gif">';

}else
if (ajax.readyState==4){

if(ajax.status==200){
document.getElementById(capa).innerHTML=ajax.respo nseText;

}else
if(ajax.status==404){
capaContenedora.innerHTML = "La direccion no existe";

}else {
capaContenedora.innerHTML = "Error: ".ajax.status;
}
}
}

ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.send("nick1="+t1+"&comentario="+t2);
return;

}
}

}



ESPERO QUE ME PUEDAN AYUDAR, YA QUE ESTOY TOTALMENTE CONFUNDIDO; MUCHAS GARCIAS
  #2 (permalink)  
Antiguo 03/05/2007, 16:36
 
Fecha de Ingreso: abril-2006
Mensajes: 80
Antigüedad: 18 años, 1 mes
Puntos: 2
Re: Duda De Compatibilidad Entre Navegadores Con Ajax

Prueba a poner:
Nick : <input type="text" name="nick1" value="" size="20" maxlength="20"/>

A ver si sigue saliéndote el error.

Deberías escribir todo el html en minúsculas, escribir los valores de los atributos entre comillas aunque sean números y cerrar las etiquetas que no tengan etiqueta de cierre, como los inputs, de la siguiente manera <input/>.

De todas formas me parece muy raro que no te lo envíe.
  #3 (permalink)  
Antiguo 03/05/2007, 16:50
 
Fecha de Ingreso: mayo-2007
Ubicación: ibague - tolima
Mensajes: 8
Antigüedad: 17 años
Puntos: 0
Re: Duda De Compatibilidad Entre Navegadores Con Ajax

Muchas gracias por tu respuesta pero hice los arreglos y no funciono, es muy raro, que no funcione en el firefox 1.5 y si en el 2, si encuentro la solucion la posteo.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:55.