Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/06/2008, 10:26
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: ayuda con barra de desplazamiento

Tu problema es que seguramente llamas periódicamente a ajax para que sobreescriba el contenido de la capa mensajes, y en cambio llamás a la línea que te sugiere Javier sólo 1 vez.
Tendrías que colocar aparte y dentro de un temporizador la línea que te pasó Javier.
Algo así:
Código PHP:
<script>
setInterval(function(){
document.getElementById('mensajes').scrollTop=5000;},200);
</script> 
Y acá tenés un ejemplo que simula tu llamado periódico a ajax, combinado con esto que te señalé antes:
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></title>
<
style>
#mensajes{ width:300px; height:300px; border:1px solid #000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9; color:#666666; overflow:auto;}
</style>
</
head>

<
body>
<
script>
function 
mensajes(){
    var 
mbr=document.createElement('br');
    var 
txt=document.createTextNode(Math.random());
    
document.getElementById('mensajes').appendChild(txt);
    
document.getElementById('mensajes').appendChild(mbr);
}
setInterval('mensajes()',200);
setInterval(function(){
document.getElementById('mensajes').scrollTop=5000;},200);
</script>

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