A bunch of cunts, mostly in the Australian sense. Except that one guy.

Stupid Javascript tricks

OK so when I use javascript to update the contents of a textarea that has content which is taller than the textarea itself, Firefox scrolls the textarea back up to the top of the content every time.

How do I automagically scroll the textarea to the bottom after each update?
Permalink Mark Warner 
January 11th, 2006
not sure if this is the correct way...

put the text box in an iframe page. resize the textbox long enough so it doesn't have a scroll bar. stick in an anchor tag at the bottom of the iframe page. javascript location.href to the anchor...
Permalink Kenny 
January 11th, 2006
There's an idea, but in this instance I can't use an iframe. Any other methods?

Thanks Kenny.
Permalink Mark Warner 
January 11th, 2006
You need to use the selection:

Check out this article:
http://www.webreference.com/programming/javascript/ncz/

Play around with that for a bit and you might be able to figure out a way.
Permalink Almost H. Anonymous 
January 11th, 2006
Come on Dennis, make him work for it!
Permalink Almost H. Anonymous 
January 11th, 2006
Thanks Dennis.


..and AA too. :)
Permalink Mark Warner 
January 11th, 2006
Dennis' answer doesn't appear to work for XUL textboxes, anyway. :-)
Permalink Mark Warner 
January 11th, 2006

This topic was orginally posted to the off-topic forum of the
Joel on Software discussion board.

Other topics: January, 2006 Other topics: January, 2006 Recent topics Recent topics