Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

<pre> tag and Text Area

Posted on 2000-02-16
Last Modified: 2010-04-09
I've a text area....I'm typing characters continuously without pressing enter....Then,I'm getting the textarea's contents and displaying in a table's cell....
I'm using <pre> tag inside my table to preserve the blank line(if any)....
It is getting displayed in one line(as I've typed characters in my textarea without pressing enter)....Is there any method/style that can be set in <pre> tag/<TR>tag that each line should take 15 chracters (say) and the 16th character should goto the next line...
Or,is there any way that I can set in text area the same?.That is,each line should take 15 characters and entering the 16th character is equivalent to pressing enter and entering that character...
Any ideas/suggestions will be greatly helpful forme....
Question by:tmmet

Author Comment

ID: 2527981
Adjusted points to 25
LVL 28

Expert Comment

ID: 2528447
Don't use the <PRE> tag, but use another method to preserve blank lines: Replace the hard returns with <BR> when displaying the text.

That is the way it works in this message board to (look at the source code of your question: it contains <br>, but you never typed them...

You should be aware that different platforms have different coding for hard returns:

Unix: ASCII 10 + ASCII 13


Expert Comment

ID: 2528457
You could process the data that you have in your textarea to insert new lines before you display them in your table cell

function formatStr(someStr){
   var returnStr ="";
   for(var i=0; i<someStr.length; i++){
      if ((i%15)==0){
          // returnStr+="<BR>";
   return returnStr

Accepted Solution

freshmeat earned 25 total points
ID: 2530032
try this:

<form name=formsname action=... method=post>
<textarea name=xxx cols=15 wrap=hard></textarea>
<input type=submin>

then u can use <pre> to print out ur text content looks like when u type it in the textarea


Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand HTML tables without having to click on it 17 56
Hide cell in a table 2 27
Html fieldset fix its height and width 4 32
HTML <font style="color:red"> 9 32
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question