Ver Mensaje Individual
  #6 (permalink)  
Antiguo 14/04/2009, 15:01
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 19 años, 10 meses
Puntos: 834
Respuesta: Controlar scroll en div

A ver si te sirve:
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>Documento sin t&iacute;tulo</title>
<
script>
function 
ver(e,m){
    var 
t=e.keyCode || e.wich;
    if(
t==13){
       
agregar(m);
        return 
false;
    }
    return 
true;
}
function 
agregar(m){
    
document.getElementById('chat').innerHTML+='<br />'+m;
    
document.forms[0].textarea.value='';
}
onload=function(){
    
setInterval(function(){document.getElementById('chat').scrollTop=document.getElementById('chat').scrollHeight},30);
}
</script>
</head>

<body>
<div id="chat" style="width:400px; height:300px; overflow:auto; border:1px solid #000"></div>
<form id="form1" name="form1" method="post" action="">
  <textarea name="textarea" cols="60" rows="3" onkeypress="return ver(event,this.value)"></textarea>
</form>
</body>
</html>