Display Box syntax

       I am new to HTML. I need to display some rows which have been retrieved from the database on the front-end. For this I need to use a scroll enabled display box with the scroll bars enabled but text input disabled(meaning the user shouldnot be able to enter or edit the rows displayed, they are strictly for viewing). How do I go on to do this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

load your results into the following:
<textarea name='theResults' id='theResults' rows=10 cols=40 onfocus=this.blur()></textarea>

suppose u're using asp.

result = ........

<textarea readonly><%=result%></textarea>
Rather then using an input control and trying to prevent the user inputing anything....

<div style="width: 45em; height: 18em; overflow: scroll;">

whatever HTML you like... so long as it can go in a <div> normally
You can have a <table> if you like.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.


Does adding a readonly attribute to ur textarea solve the problem ....

like <textarea name='theResults' id='theResults' rows=4 cols=40 readonly>
you'll have to use ASP to pull up info from database.

Hi medebayan,
There are already HTML attributes made for this.

You can use:
<textarea name='theResults' id='theResults' rows=4 cols=40 readonly>
<textarea name='theResults' id='theResults' rows=4 cols=40 disabled>

-receive focus but cannot be modified by the user.
-are included in tabbing navigation.

-do not receive focus.
-are skipped in tabbing navigation.


Don't use this, please. Use readonly or disabled.

Another solution would be to place the data retrieval/display code in a separate .asp page and then include that page into the main page using an iframe.

<iframe width="250" height="400" src="data.asp"></iframe>

To locak the iframe frame in place, you can use CSS positioning or put the iframe tag inside a table cell.
>>Don't use this, please. Use readonly or disabled.

Why? Has the code suddenly become inoperable?  Are they being deprecated?  Or, is it because it is not an "approved" coding practice? Or, perhaps because the code works with all browsers -- even the 'standards-compliant' ones whereas 'readonly and disabled' only work with version 5+ browsers

The reason disabled or readonly are 'better' to use is first of all because that is the proper way of doing this in HTML. It's been so since HTML4 was a final recommendation in '97. For all the users that have javascript turned off, this javascript function will not work. Now, you could argue that very few people turn off their javascript, just as one could argue that very few users have browsers in the 4 generation or below. But taken the question is asked in the HTML forum and that HTML actually have attributes created for this, the 'standard compliant' way of coding this would be to use the appropiate attributes.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vincent, consider what onfocus="this.blur();" does if you're trying to use the keyboard to navigate.
Hi kylkken,

>>But taken the question is asked in the HTML forum...


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.