Results 1 to 2 of 2

Thread: I need Linebreaks?? textarea.value using javascript, then assign to td.textContent

  1. #1
    dorisf Guest

    I need Linebreaks?? textarea.value using javascript, then assign to td.textContent

    I am desparate for some help - worked all day on this silly little problem:


    Wanted:
    ======
    To read the typed in text in a textarea using javascript - with both IE and Firefox,
    then to stuff that value into a table's td, or a label.

    The end result is the TD should retain the linebreaks that were entered in the textarea.

    This works fine in IE but not in Firefox - and after browing the net all day - I cant seem to find an answer.

    Is there an answer? Please help me someone.

    My Kindest Regards,

    Doris.


    MY SAMPLE CODE
    ============================
    HTML
    ++++++++++
    <textarea name="text" id="text2" cols="45" rows="8"></textarea>

    <div onclick="javascript:Here();">click here</div>

    <table runat="server" ID="id"><tr><td runat="server" ID="id">dsadsadaa</td></tr></table>

    JAVASCRIPT
    ++++++++++
    objTDClientID = document.getElementById("id1");
    var ss = document.getElementById('text2').value;
    ss = ss.replace(/(\r\n)|(\n)/g, "<br />");




    if (objTDClientID.textContent) {
    objTDClientID.textContent = objTextArea.value;
    }
    else {
    objTDClientID.innerHTML = ss;
    }

  2. #2
    Join Date
    Apr 2009
    Location
    The toon
    Posts
    1,225
    view the source and see if the <br /> is being output

Similar Threads

  1. JavaScript Collector
    By JavaScriptBank in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Jul 2009, 03:28 AM
  2. JavaScript library
    By JavaScriptBank in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Jul 2009, 01:26 AM
  3. element specific javascript
    By gumbo in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 04 Dec 2005, 06:25 PM
  4. element specific javascript
    By gumbo in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 04 Dec 2005, 06:23 PM

Posting Permissions

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