Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making text boxes scroll down

Status
Not open for further replies.

iamjarad

MIS
Jun 19, 2007
3
I am writing to multiple text boxes. Is there a way that the text boxes will scroll down as the program writes additional lines to them? ...without giving them focus, if possible?
 
window.document.getElementById("txtarea1").scrollTop = 10000

- txtarea1 would be the id of the textarea
- 10000 would be a very large number to keep scrolling down...a higher number would be needed depending on the lines in the textarea

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
To do this, on the server side I count the number of line feed characters in the text blob, then set the number of lines in the text box. Use a horizontal scroll to prevent word wrap.

If not doing a web application, in Microsoft Access or a VB program I would examine window bits and see if scroll bars had appeared, and if so, increase the text box height.
 
Another way to do this is use a <td> tag in a table, give it an ID attribute, and update the innertext property. You can give the <td> a border and make it look like a text box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top