This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
"View only" Text field

Hi, I was wondering how I would add a field to my webpage that is somewhat like a text field but it is "View Only," like the code tags used in most forums or the code boxes used in layout sites. It will be used to display code in a more defined area that is easy too recognize yet has a scrollbar so that it can contain large amounts of code and still fit within a single screen.

Thanks in advance for any help.

Re: "View only" Text field

Re: "View only" Text field

Why the scrollbar?
"so that it can contain large amounts of code and still fit within a single screen."


So why is it better - for your visitor - to scroll a box instead of a page? Look at Macmc's answer and imagine how annoying it would be with a few hundred more words in there.

Re: "View only" Text field

Thanks for the attempt Macmc, but unless you can tell me how to make it unchangeable, it won't work. Also its got to be able to be color coded to highlight certain things. Not shure if that is accomplishable or not with a basic Text Field.

Corwings
Why the scrollbar?
"so that it can contain large amounts of code and still fit within a single screen."


So why is it better - for your visitor - to scroll a box instead of a page? Look at Macmc's answer and imagine how annoying it would be with a few hundred more words in there.


Because my webpage is a guide. By having coding for a program contained within a defined area for review and giving a visual seperation between what is code and what is not. Some of the codes displayed are 100's of lines long and occasionally there is only 1-2 lines of text before and after said code describing something as part of the guide and they could scroll right past it on a plain webpage.




Found the answer to my problem myself finally via a web search, if anyone else has been wondring how to accomplish something similar to this, here is the code for it.

Code:
<div style="overflow:auto; height:100px; width:300px">
<table cellpadding="0" cellspacing="0" style="width:250px;">
<tr>
<td> A <br>B<br>C<br>D<br>E</td>
</tr>
</table>
</div>







A
B
C
D
E

Re: "View only" Text field

Just so you know, textareas have a "readonly" attribute you can set on them. W3C explanation

Browser: Mozilla Firefox 3.6.*

OS: Windows 7