Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Ajax.js
PHP
try{xmlhttp = new XMLHttpRequest();
}catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
}
fila=[];
ifila=0;
function carrega(url, destino){
document.getElementById(destino).innerHTML="<center><img src='i_animated_loading_32_2.gif'><br><b>Carregando...</b></center>";
fila[fila.length]=[url,destino];
if((ifila+1)==fila.length)ajaxRun();
}
function ajaxRun(){
url = fila[ifila][0];
destino = fila[ifila][1];
xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
xmlhttp.setRequestHeader("Pragma", "no-cache");
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4){
texto=unescape(xmlhttp.responseText.replace(/+/g," "));
document.getElementById(destino).innerHTML=texto;
ifila++;
if(ifila<fila.length)setTimeout("ajaxRun()",20);
}
}
xmlhttp.send(url);
}
function enviaForm(frmNome, url, destino){
f = document.getElementById(frmNome);
var query=url;
for (i=0;i<f.elements.length;i++){
query += i==0 ? '?' : '&';
query += f.elements[i].name + '=' + f.elements[i].value;
}
carrega(query, destino);
}
index.php
PHP
<html><head><script src="ajax.js" type="text/javascript"></script></head>
<body>
<div class="publicidade" id="publicidade"><? include('pub.php'); ?></div>
</body>
</html>
pub.php
PHP
<script type="text/javascript"><!--google_ad_client = "pub-8211403903713688";
//468x60, criado 15/11/07
google_ad_slot = "6857524816";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
bom como eu não sei nada, bom quase nada de javascript, ajax,,
vim pedir uma ajudinha
gostaria que a div publicidade no index.php fizesse REFRESH a cada 15 segundos por exemplo..
se poderem me ajudar Agradeço..
Carregando comentários...