estou com um problema aqui e queria saber se vocês conseguem me ajudar!
estou com um script aqui em AJAX e PHP e fica atualizando a cada 1 segundo 2 div´s, até q funcionou no Firefox, Chrome e Netscape , so que no I.E. não! aqui vai o site q eu to fazendo... ta em desenvolvimento, na verdade em teste destes script, http://www.vocenolan....br/site/leilao
e aqui vai o script em PHP q gera o AJAX para cada DIV!, é meio grandinho, e ele fica requisitando duas paginas em PHP que fica pegando informação do BD!
<?php require("../conexao_bd.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $tit_site;?></title>
<link rel="stylesheet" href="../css/site.css" type="text/css" media="screen" />
<script>
<?php
$sqlProd3 = mysql_query("Select id from produtos where ativo='Sim' and finalizado != 'Sim' order by id DESC");
while($r3=mysql_fetch_array($sqlProd3)){
?>
AjaxV<?php echo $r3[0]?> = function (){
try{
xmlhttpV<?php echo $r3[0]?> = new XMLHttpRequest();
}catch(ee){
try{
xmlhttpV<?php echo $r3[0]?> = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttpV<?php echo $r3[0]?> = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttpV<?php echo $r3[0]?> = false;
}
}
}
}
AjaxU<?php echo $r3[0]?> = function (){
try{
xmlhttpU<?php echo $r3[0]?> = new XMLHttpRequest();
}catch(ee){
try{
xmlhttpU<?php echo $r3[0]?> = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttpU<?php echo $r3[0]?> = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttpU<?php echo $r3[0]?> = false;
}
}
}
}
function ajaxUser<?php echo $r3[0]?>( nomeUrl<?php echo $r3[0]?>, divRetorno<?php echo $r3[0]?> ){
var divInsereResposta<?php echo $r3[0]?> = document.getElementById( divRetorno<?php echo $r3[0]?> );
url<?php echo $r3[0]?> = antiCacheRandU(nomeUrl<?php echo $r3[0]?>);
AjaxU<?php echo $r3[0]?>();
xmlhttpU<?php echo $r3[0]?>.open("GET", url<?php echo $r3[0]?>, true);
xmlhttpU<?php echo $r3[0]?>.onreadystatechange=function() {
if (xmlhttpU<?php echo $r3[0]?>.readyState==4){
divInsereResposta<?php echo $r3[0]?>.innerHTML = xmlhttpU<?php echo $r3[0]?>.responseText;
}
}
xmlhttpU<?php echo $r3[0]?>.send(null)
}
function ajaxValor<?php echo $r3[0]?>( nomeUrl<?php echo $r3[0]?>, divRetorno<?php echo $r3[0]?> ){
var divInsereResposta<?php echo $r3[0]?> = document.getElementById( divRetorno<?php echo $r3[0]?> );
url<?php echo $r3[0]?> = antiCacheRandV(nomeUrl<?php echo $r3[0]?>);
AjaxV<?php echo $r3[0]?>();
xmlhttpV<?php echo $r3[0]?>.open("GET", url<?php echo $r3[0]?>, true);
xmlhttpV<?php echo $r3[0]?>.onreadystatechange=function() {
if (xmlhttpV<?php echo $r3[0]?>.readyState==4){
divInsereResposta<?php echo $r3[0]?>.innerHTML = xmlhttpV<?php echo $r3[0]?>.responseText;
}
}
xmlhttpV<?php echo $r3[0]?>.send(null)
}
<?php } ?>
function antiCacheRandV(aurl){
var dt = new Date();
if(aurl.indexOf("?")>=0){// já tem parametros ADAPTA RANDOM / SE não CRIA PARAM. RANDOM
return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime());
}else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());}
}
function antiCacheRandU(aurl){
var dt = new Date();
if(aurl.indexOf("?")>=0){// já tem parametros ADAPTA RANDOM / SE não CRIA PARAM. RANDOM
return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime());
}else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());}
}
function atualiza(){
<?php
$sqlProd2 = mysql_query("Select id from produtos where ativo='Sim' and finalizado != 'Sim' order by id DESC");
while($r=mysql_fetch_array($sqlProd2)){
?>
ajaxUser<?php echo $r[0]?>('user.php?id=<?php echo $r[0]?>','user<?php echo $r[0]?>');
ajaxValor<?php echo $r[0]?>('valor.php?id=<?php echo $r[0]?>','valor<?php echo $r[0]?>');
<?php } ?>
}
</script>
</head>
<body onload="atualiza()">
<table width="575" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top"><br />
<br /></td>
</tr>
<tr>
<td width="527" valign="top"><table width="514" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="514"><img src="../imagens/meioPrincipal/tit_produtosLeilao.jpg" width="514" height="40" /></td>
</tr>
<tr>
<td background="../imagens/meioPrincipal/fundo_meio.jpg"><?php
$sqlProd = mysql_query("Select * from produtos where ativo='Sim' and finalizado != 'Sim' order by id DESC Limit 1");
while($row_prod=mysql_fetch_array($sqlProd)){?>
<div id="boxmeio">
<table width="306" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="306" align="center"><table width="301" border="0" cellspacing="2" cellpadding="2">
<tr>
<td><div align="left"></div></td>
</tr>
<tr>
<td class="style7"><div align="left" class="style10"></div></td>
</tr>
<tr>
<td class="style8"><div align="left"></div></td>
</tr>
<tr>
<td class="style8"><div align="left" id="valor<?php echo $row_prod['id']?>"></div></td>
</tr>
<tr>
<td class="style8"><div align="left" id="user<?php echo $row_prod['id']?>"></div></td>
</tr>
<tr>
<td><div align="left"><a href="java script:void(0);"><img src="../imagens/meioPrincipal/bt_darLance.jpg" width="111" height="22" border="0" /></a></div></td>
</tr>
</table></td>
</tr>
</table>
</div>
<img src="../imagens/spacer.gif" width="1" height="3" />
<?php } ?>
</td>
</tr>
<tr>
<td><img src="../imagens/meioPrincipal/baixo.jpg" width="514" height="9" /></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<script>
setInterval("atualiza()",1000);
</script>
Pergunta
~Ventura~
E ai pessoal,
estou com um problema aqui e queria saber se vocês conseguem me ajudar!
estou com um script aqui em AJAX e PHP e fica atualizando a cada 1 segundo 2 div´s, até q funcionou no Firefox, Chrome e Netscape , so que no I.E. não! aqui vai o site q eu to fazendo... ta em desenvolvimento, na verdade em teste destes script, http://www.vocenolan....br/site/leilao
e aqui vai o script em PHP q gera o AJAX para cada DIV!, é meio grandinho, e ele fica requisitando duas paginas em PHP que fica pegando informação do BD!
<?php require("../conexao_bd.php");?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?php echo $tit_site;?></title> <link rel="stylesheet" href="../css/site.css" type="text/css" media="screen" /> <script> <?php $sqlProd3 = mysql_query("Select id from produtos where ativo='Sim' and finalizado != 'Sim' order by id DESC"); while($r3=mysql_fetch_array($sqlProd3)){ ?> AjaxV<?php echo $r3[0]?> = function (){ try{ xmlhttpV<?php echo $r3[0]?> = new XMLHttpRequest(); }catch(ee){ try{ xmlhttpV<?php echo $r3[0]?> = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ xmlhttpV<?php echo $r3[0]?> = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttpV<?php echo $r3[0]?> = false; } } } } AjaxU<?php echo $r3[0]?> = function (){ try{ xmlhttpU<?php echo $r3[0]?> = new XMLHttpRequest(); }catch(ee){ try{ xmlhttpU<?php echo $r3[0]?> = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ xmlhttpU<?php echo $r3[0]?> = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttpU<?php echo $r3[0]?> = false; } } } } function ajaxUser<?php echo $r3[0]?>( nomeUrl<?php echo $r3[0]?>, divRetorno<?php echo $r3[0]?> ){ var divInsereResposta<?php echo $r3[0]?> = document.getElementById( divRetorno<?php echo $r3[0]?> ); url<?php echo $r3[0]?> = antiCacheRandU(nomeUrl<?php echo $r3[0]?>); AjaxU<?php echo $r3[0]?>(); xmlhttpU<?php echo $r3[0]?>.open("GET", url<?php echo $r3[0]?>, true); xmlhttpU<?php echo $r3[0]?>.onreadystatechange=function() { if (xmlhttpU<?php echo $r3[0]?>.readyState==4){ divInsereResposta<?php echo $r3[0]?>.innerHTML = xmlhttpU<?php echo $r3[0]?>.responseText; } } xmlhttpU<?php echo $r3[0]?>.send(null) } function ajaxValor<?php echo $r3[0]?>( nomeUrl<?php echo $r3[0]?>, divRetorno<?php echo $r3[0]?> ){ var divInsereResposta<?php echo $r3[0]?> = document.getElementById( divRetorno<?php echo $r3[0]?> ); url<?php echo $r3[0]?> = antiCacheRandV(nomeUrl<?php echo $r3[0]?>); AjaxV<?php echo $r3[0]?>(); xmlhttpV<?php echo $r3[0]?>.open("GET", url<?php echo $r3[0]?>, true); xmlhttpV<?php echo $r3[0]?>.onreadystatechange=function() { if (xmlhttpV<?php echo $r3[0]?>.readyState==4){ divInsereResposta<?php echo $r3[0]?>.innerHTML = xmlhttpV<?php echo $r3[0]?>.responseText; } } xmlhttpV<?php echo $r3[0]?>.send(null) } <?php } ?> function antiCacheRandV(aurl){ var dt = new Date(); if(aurl.indexOf("?")>=0){// já tem parametros ADAPTA RANDOM / SE não CRIA PARAM. RANDOM return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime()); }else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());} } function antiCacheRandU(aurl){ var dt = new Date(); if(aurl.indexOf("?")>=0){// já tem parametros ADAPTA RANDOM / SE não CRIA PARAM. RANDOM return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime()); }else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());} } function atualiza(){ <?php $sqlProd2 = mysql_query("Select id from produtos where ativo='Sim' and finalizado != 'Sim' order by id DESC"); while($r=mysql_fetch_array($sqlProd2)){ ?> ajaxUser<?php echo $r[0]?>('user.php?id=<?php echo $r[0]?>','user<?php echo $r[0]?>'); ajaxValor<?php echo $r[0]?>('valor.php?id=<?php echo $r[0]?>','valor<?php echo $r[0]?>'); <?php } ?> } </script> </head> <body onload="atualiza()"> <table width="575" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" valign="top"><br /> <br /></td> </tr> <tr> <td width="527" valign="top"><table width="514" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="514"><img src="../imagens/meioPrincipal/tit_produtosLeilao.jpg" width="514" height="40" /></td> </tr> <tr> <td background="../imagens/meioPrincipal/fundo_meio.jpg"><?php $sqlProd = mysql_query("Select * from produtos where ativo='Sim' and finalizado != 'Sim' order by id DESC Limit 1"); while($row_prod=mysql_fetch_array($sqlProd)){?> <div id="boxmeio"> <table width="306" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="306" align="center"><table width="301" border="0" cellspacing="2" cellpadding="2"> <tr> <td><div align="left"></div></td> </tr> <tr> <td class="style7"><div align="left" class="style10"></div></td> </tr> <tr> <td class="style8"><div align="left"></div></td> </tr> <tr> <td class="style8"><div align="left" id="valor<?php echo $row_prod['id']?>"></div></td> </tr> <tr> <td class="style8"><div align="left" id="user<?php echo $row_prod['id']?>"></div></td> </tr> <tr> <td><div align="left"><a href="java script:void(0);"><img src="../imagens/meioPrincipal/bt_darLance.jpg" width="111" height="22" border="0" /></a></div></td> </tr> </table></td> </tr> </table> </div> <img src="../imagens/spacer.gif" width="1" height="3" /> <?php } ?> </td> </tr> <tr> <td><img src="../imagens/meioPrincipal/baixo.jpg" width="514" height="9" /></td> </tr> </table></td> </tr> </table> </body> </html> <script> setInterval("atualiza()",1000); </script>desde já agradeço!
Carlos Ventura
Link para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.