no chrome não funciona
Meus amigos,
Estou com esse código a baixo, no explorer e mozila funciona muito bem mais no chrome não funciona.
a função é chamada por um select
alguem aqui pode ajudar a encontrar uma solução?
function objetoAjax(){
var xmlhttp=false;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
try //Google Chrome
{
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET",file,false);
xmlhttp.send(null);
xmlDoc = xmlhttp.responseXML.documentElement;
}
catch(e)
{
xmlhttp = false;
}
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function List(id){
divCategorias = document.getElementById('categorias');
ajax=objetoAjax();
ajax.open("GET", "list.php?pag="+id);
divCategorias.innerHTML= '<img src="images/loading.gif">';
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
divCategorias.innerHTML = ajax.responseText
}
}
ajax.send(null)
}
<select class="sty_select" id="cat" name="cat"/>
<option onClick="List('id=1');">id 1</option>
<option onClick="List('id=2');">id 2</option>
</select>Discussão (2)
Carregando comentários...