Problem to add text to the textbox

This is a discussion on "Problem to add text to the textbox" within the JavaScript Forum section. This forum, and the thread "Problem to add text to the textbox are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 20th, 2006, 21:38
New Member
Join Date: Aug 2006
Location: Los
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Problem to add text to the textbox

Dear all,

I add some text to the textarea and the text will be added like this:

var mdiv = document.getElementById("messages");

for (i=0; i<2000; i++) {
mdiv.innerHTML = mdiv.innerHTML + "text <br/>\r\n";
}

How can I put the scrollbar down, to the last input during the text is added? Now, the user have to move the scroll bar, after the text was added. It can be so, that the text will be added dynamically and I want to show the user the actuall block of the information. How can the program follow the input and output is always down in the box?

Actually I am not going to use textarea, I have created div:

<table><tr><td width="200" height="200"><div id="messages"></div>
</td></tr></table>

<style type="text/css">
#messages {
background: white;
margin-left: 5px;
height: 98%;
padding-left: 5px;
padding-right: 5px;
border: 1px solid #256087;
overflow: scroll;
margin-right: 5px;
}
</style>

It should be like in a chat. But in my case after the text was added, the scroll bar is up and if I move scroll bar, while adding a new portion of information, it's not good.

Thanks in advance.
Reply With Quote

  #2 (permalink)  
Old Aug 21st, 2006, 06:43
New Member
Join Date: Aug 2006
Location: Los
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Re: Problem to add text to the textbox

I have tried focus(), but it sets focus to the textbox and not to content. The scroll don't move to the last input. Still can't solve the problem.
Reply With Quote
Reply

Tags
problem, add, text, textbox

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with hiding (indenting) text kobesunset Starting Out 4 May 11th, 2008 14:06
Cross-browser text problem LarsUnit Web Page Design 5 Oct 8th, 2007 15:19
Text box disable problem in Safari Thanuja JavaScript Forum 1 Jun 15th, 2007 14:21
XML PHP #text problem Don Logan Other Programming Languages 0 Mar 19th, 2006 19:42
TextBox problem accessman Databases 1 Oct 15th, 2005 01:19


All times are GMT. The time now is 05:56.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43