Tema: Abrir Pop-up
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 31/07/2011, 22:44
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: Abrir Pop-up

Fijate si te sirve algo así:
1.php:
Código PHP:
<?php
session_start
();
set_time_limit(0);
if(isset(
$_REQUEST['aux'])){
    if(isset(
$_SESSION['progress']))
        echo 
$_SESSION['progress'];
    else
        echo 
0;
    exit;
}
session_write_close();
$i=0;
while(++
$i<=100){
    @
session_start();
     echo 
"\n"
     @
ob_flush(); 
     @
flush(); 
    
$_SESSION['progress']=$i;
    
session_write_close();
    
sleep(1);
}
echo 
'Fin';
?>
2.php:
Código 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=utf-8" />
<
title>Documento sin título</title>
<
script type="text/javascript">
function 
http(){ 
    if(
typeof window.XMLHttpRequest!='undefined'){ 
        return new 
XMLHttpRequest(); 
    }else{ 
        try{ 
            return new 
ActiveXObject('Microsoft.XMLHTTP'); 
        }catch(
e){ 
            
alert('Su navegador no soporta AJAX'); 
            return 
false
        } 
    } 

function 
request(url,callback,params){ 
    var 
H=new http(); 
    if(!
H)return; 
    
H.open('post',url+'?'+Math.random(),true); 
    
H.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    
H.onreadystatechange=function(){ 
        if(
H.readyState==4){
            if(
H.responseText.indexOf('99')!=-1){
                    
ns.monit=0;
            }
            if(
callback)
                
callback(H.responseText); 
            
H.onreadystatechange=function(){} 
            
H.abort(); 
            
H=null
        } 
    } 
    var 
p=''
    for(var 
i in params){ 
        
p+='&'+i+'='+escape(params[i]); 
    } 
    
H.send(p); 
}
function $(
x){return document.getElementById(x);} 

function 
f(r){
    $(
'pp').innerHTML=r;
}
function 
m(r){
    $(
'pp').innerHTML='<div style="width:500px; height:10px; border:1px solid #000"><div style="height:10px; background:red; width:'+r+'%"></div></div>';
    if(
ns.monit){
        
setTimeout(function(){
                
request(ns.file,m,{'aux':1});            
        },
1000);
    }
}
var 
ns={monit:1,file:'1.php'}
onload=function(){ 
        
request(ns.file,m,{'aux':1});
        
request(ns.file,f,{}); 
        

</script>

</head>

<body>
<div id="pp"></div>
</body>
</html>