简体   繁体   中英

How can I embed a scrollable text box to output text on my web page?

Is it possible to embed a scrollable text box to output text on my web page, in HTML or JavaScript?

I am trying not to use any Java libraries if possible.

<textarea></textarea>
    <style type="text/css" media="screen">

    #messages{
        border : solid 2px #ff0000; background : #D5D5D5;  padding : 4px; width : 500px; height : 350px; overflow : auto; 
    }
</style>

    <div id='messages'>
</div>

to scroll down with jquery:

$('#messages').scrollTop( $('#messages')[0].scrollHeight );

Since the question is pretty vague i am going to recommend jScroller (since i've used it for some projects)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM