Jump to content

auto scroll bar of text-area


Pawan_Agarwal

Recommended Posts

</html>

 

<script type="text/javascript">

var inc = 10;

 

function move_down()

{

bar = document.getElementById('tarea');

inc += 10;

bar.scrollTop = inc;

document.getElementById("write").innerHTML = inc;

}

 

function move_up()

{

bar = document.getElementById('tarea');

inc -= 10;

bar.scrollTop = inc;

document.getElementById("write").innerHTML = inc;

}

 

setInterval(

function()

{

if(inc>=450)

{move_up();}

if(inc<450)

{move_down();}

}

,100);

</script>

 

<body>

This is a code that will help in

running data in the same loation, vertically

<br>

<br>

<textarea rows="10" cols="20" id="tarea">  

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

this is a text

 

</textarea>  

<br><br>

<button onclick="movedown()" id="tarea">Click here</button><br>

<div id="write"></div>

</body>

</html>

 

 

I am trying to make a auto scroll function in java script, however,  I am unable to do it, can you help with the code and tell what is wrong with the code ....................
Link to comment
https://forums.phpfreaks.com/topic/280287-auto-scroll-bar-of-text-area/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.