Ahí va:
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=iso-8859-1" />
<title>test</title>
<style>
#marco{
width:300px;
border:1px solid #000;
}
#barra{
width:0; background-color:#F00;
}
</style>
<script>
function aj(){
if(window.XMLHttpRequest){
return new XMLHttpRequest();
}
else{
try{
return new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
alert('tu navegador no soporta ajax');
return false;
}
}
}
var porciento;
function rpc(url){
var rpc=aj();
if(rpc){
rpc.open('GET',url,true);
rpc.onreadystatechange=function(){
if(rpc.readyState==4){
porciento=rpc.responseText;
}
}
rpc.send(null);
}
}
function progress(porcentaje){
document.getElementById('barra').style.width=porcentaje+'%';
}
window.onload=function(){
var pp=setInterval(function(){if(typeof porciento!='undefined')progress(porciento);if(porciento>99){clearInterval(pp);};rpc('procesando.php');},50);
}
</script>
</head>
<body>
<div id="marco"><div id="barra"> </div></div>
</body>
</html>