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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy replace function

    I just want to replace all \n with <BR>. I have made this script:

    function doText() {
    var text=document.layout.text.value;
    text=text.replace(/\n/g,"<BR>");
    document.layout.text.value=text;
    }

    If I write

    "test

    test"

    the script returns:

    "test
    <BR>
    <BR>test"

    So, it doesn't seem to get rid of the \n 's???

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And this:

    "test
    <BR>
    <BR>test"

    Once rendered will return:
    "test

    test"

    .....Willy


  •  

    Posting Permissions

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