Ver Mensaje Individual
  #20 (permalink)  
Antiguo 17/04/2009, 12:23
Zack78
(Desactivado)
 
Fecha de Ingreso: enero-2008
Mensajes: 272
Antigüedad: 16 años, 3 meses
Puntos: 1
Respuesta: Controlar scroll en div

Cita:
Iniciado por Panino5001 Ver Mensaje
Bueno, agregando un pequeño control que se active onmouseover y onmouseout creo que se soluciona:
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(){if(window.parar)return;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" onmouseover="parar=1" onmouseout="parar=0"></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> 
Muchas gracias, al fin pude solucionar mi problema de scroll

Funciono perfectamente como queria gracias nuevamente.