Solved

<pre> tag and Text Area

Posted on 2000-02-16
4
283 Views
Last Modified: 2010-04-09
Hi,
 
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....
0
Comment
Question by:tmmet
[X]
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
4 Comments
 

Author Comment

by:tmmet
ID: 2527981
Adjusted points to 25
0
 
LVL 28

Expert Comment

by:sybe
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
PC: ASCII 10
MAC: ASCII 13


0
 
LVL 1

Expert Comment

by:dmaryakh
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+="\n";
          // returnStr+="<BR>";
      }
      returnStr+=someStr.charAt(i);
   }
   return returnStr
}
0
 
LVL 2

Accepted Solution

by:
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>
</form>



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

:)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

730 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