Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

leandro07

Problemas no IE

Recommended Posts

Pessoal tem algo errado nessa função?

 

function ajax(url){	//alert(nick);	//alert(dest);	//alert(msg);	req = null;	// Procura por um objeto nativo (Mozilla/Safari)	if (window.XMLHttpRequest) {		req = new XMLHttpRequest();		req.onreadystatechange = processReqChange;		req.open("GET",url,true);		req.send(null);		// Procura por uma versão ActiveX (IE)	} else{		try { 			 req=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)		  }		  catch(e) {			try { 		   		req=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)			}   			catch(e) { /* O navegador não tem suporte */ 		   		req=false; 			}		  }		//req = new ActiveXObject("Microsoft.XMLHTTP");		if (req) {			req.onreadystatechange = processReqChange;			req.open("GET",url,true);			req.send();		}	}}

Não funfa no IE, soh no FF.

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

o que é para ela fazer?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Seguinte , to tentando implementar aquela busca instantânea que ao digitar ele já faz a procura e mostra os resultados. No FF ele ta funfando direitinho mas no IE não mostra nada e da erro de JavaScript.

 

function url_decode(str) {	var n, strCode, strDecode = "";		for (n = 0; n < str.length; n++) {		if (str.charAt(n) == "%") {			strCode = str.charAt(n + 1) + str.charAt(n + 2);			strDecode += String.fromCharCode(parseInt(strCode, 16));			n += 2;		} else {			strDecode += str.charAt(n);		}	}		return strDecode; }function ajax(url){	//alert(nick);	//alert(dest);	//alert(msg);	req = null;	// Procura por um objeto nativo (Mozilla/Safari)	if (window.XMLHttpRequest) {		req = new XMLHttpRequest();		req.onreadystatechange = processReqChange;		req.open("GET",url,true);		req.send(null);		// Procura por uma versão ActiveX (IE)	} else{		try { 			 req=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)		  }		  catch(e) {			try { 		   		req=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)			}   			catch(e) { /* O navegador não tem suporte */ 		   		req=false; 			}		  }		//req = new ActiveXObject("Microsoft.XMLHTTP");		if (req) {			req.onreadystatechange = processReqChange;			req.open("GET",url,true);			req.send();		}	}}function processReqChange(){	// apenas quando o estado for "completado"	if (req.readyState == 4) {			// apenas se o servidor retornar "OK"			if (req.status ==200) {				// procura pela div id="pagina" e insere o conteudo			// retornado nela, como texto HTML				document.getElementById('pagina').innerHTML = url_decode(req.responseText);			} else {			alertdor("Houve um problema ao obter os dados:\n" + req.statusText);		}	}}
Esse é o meu código js... aí coloca no onkeyup do meu input pra chamar essa função:

 

function pesquisa(valor){				url="busca_nome.php?valor="+valor;				ajax(url);			}
Ai na busca_nome.php tem a chamada no banco e retorna as linhas necessárias.

 

Obrigado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.