Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/12/2004, 10:21
kepawe
 
Fecha de Ingreso: agosto-2004
Mensajes: 157
Antigüedad: 20 años, 6 meses
Puntos: 5
Hola Wanito

El objeto textarea tiene la propiedades scrollTop para el scroll lateral y scrollLeft para la barra inferior, estas devuelven la posición de los scroll y permiten asignarles un nuevo valor.
Te envío este ejemplo.



Código PHP:

<html>
<
head>

</
head>

<
body>
<
form>
<
textarea id="abc" style="position:relative;border:solid 1px black;overflow:hidden;"
rows="5" cols="20" onfocus="control =0;move_scroll()" onblur="control = 1">
Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,
Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,
</
textarea>
<
textarea id ="def" style="position:relative;border:solid 1px black;overflow:auto;"
rows="5" cols="20" onfocus="control =0;move_scroll()" onblur="control = 1" >
Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,
Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,Blablabla,
</
textarea>

<
script>

var 
timeout_id setTimeout('move_scroll()',100)
var 
control 1
function move_scroll(){
  var 
t1 document.getElementById("abc")
  var 
t2 document.getElementById("def")
  
  
t1.scrollTop t2.scrollTop
  
if(control){
    
clearTimeout(timeout_id)
  }
  else{
    
timeout_id setTimeout('move_scroll()',100)
  }
}


</script>
</body>
</html> 
Espero que te sirva.

Un saludo