Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 17th, 2004, 10:08 AM
Registered User
Join Date: Jul 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Repositioning a scrollable window

Hi, I have a table that becomes scrollable after 10 lines. This table can contain hundreds of lines of data. New data is entered in a text area below the table.

After new data is entered and the screen is refreshed I would like to have the last line (new data) visible at the bottom of the table.
The same as if you where to drag the scroll bar to the bottom of the table. I just want this to happen automatically.

Any ideas?

Old June 17th, 2004, 10:50 AM
Registered User
Join Date: Jul 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Hi I kept searching and found an example that works at http://forums.devshed.com/archive/t-14600
I tested the example and it works just the way I wanted it to.


Here is the code.

This works on IE5.5 and seems to work most of the time on NS 4.7 <html>
<title>Scroll textbox</title>
<script language=javascript>

function scrollTextarea()
{var obj=document.forms.main.elements.text;

var gradual=true; // true to scroll slowly, false to jump


if (document.layers)
else if (gradual)
{var top=-1
while (top<obj.scrollTop)

function fillTextarea()
{var htmlStr="";
for (var i=0;i<100;i++)
{htmlStr+="<h3>Line "+i+"</h3>\n"}

<body bgcolor=black onload="fillTextarea();scrollTextarea();">
<basefont face=arial color=lime>
<h2>Scroll textbox</h2>
<form name=main action=# method=get>
<textarea name=text rows=10>
</html>Not sure how will get on in NS6, but NS6 won't lanuch at the moment to test!!
Referred to msdn (http://msdn.microsoft.com/workshop/c...s/textarea.asp) for dom


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollable Table Options ? asearle XSLT 1 October 28th, 2007 04:11 PM
how to create scrollable datagrid? basant ADO.NET 6 September 11th, 2006 09:55 PM
Scrollable Control - Alternatives? pagates C# 4 April 5th, 2006 03:26 AM
Repositioning Top Left Corner of a Page in print dontknowmuch Java GUI 0 September 30th, 2005 12:05 PM
scrollable window crmpicco Javascript How-To 2 February 11th, 2005 03:56 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.