Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to keep lines in textarea

    whenever I record input from a textarea, it prints everything in one straight line.

    How do I discover and parse the text area data based on the layout it was in the textarea?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The question would be how are you recording the input?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Here's one way...


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD><TITLE> </TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <STYLE type=text/CSS>

    </STYLE>
    <SCRIPT type="text/javascript">
    function mno(){
    k=escape(document.getElementById('txt').value)

    while(k.indexOf('%0D%0A')!=-1){k = k.replace('%0D%0A','<br>');}
    document.getElementById('jkl').innerHTML=unescape(k)}
    </SCRIPT>

    <META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
    <BODY onload="mno()">
    <textarea id="txt" rows=10 onchange="mno()">
    abc
    def
    ghi
    </textarea>

    <div ID="jkl"></div>
    </BODY></HTML>


    Needs work around unescape(k)
    Last edited by rubenbuhr; 11-06-2006 at 06:50 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •