add carriage return?!

Discussion in 'Javascript' started by Geoff Cox, Sep 13, 2005.

  1. Geoff Cox

    Geoff Cox Guest

    Hello,

    How do I get a carriage return after each of the names?!

    Cheers

    Geoff

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Untitled</title>

    <script>

    var results="";

    var text_0 = new Array(2);
    text_0[0] = "becky";
    text_0[1] = "jim";

    var text_1 = new Array(2);
    text_1[0] = "fred";
    text_1[1] = "susan";

    function save()
    {

    for (var z= 0; z <2; z++)
    {

    for (var i = 0; i < 2; i++)
    {
    results += window["text_" + z] + ' ';
    }
    }
    document.write(results);

    }
    </script>

    </head>

    <body>

    <button onclick="save()">try</button>

    </body>
    </html>
     
    Geoff Cox, Sep 13, 2005
    #1
    1. Advertising

  2. Geoff Cox

    Geoff Cox Guest

    On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
    <> wrote:

    >
    >> How do I get a carriage return after each of the names?!

    >
    >
    > results += window["text_" + z] + ' <br>';


    Zoe,

    That works fine in the code I posted but will not work when I use this
    method when sending data via email using formmail.cgi - any idea what
    to use there?

    Cheers

    Geoff
     
    Geoff Cox, Sep 13, 2005
    #2
    1. Advertising

  3. Geoff Cox

    ASM Guest

    Geoff Cox wrote:
    > On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
    > <> wrote:
    >
    >
    >>>How do I get a carriage return after each of the names?!

    >>
    >>
    >>results += window["text_" + z] + ' <br>';

    >
    >
    > Zoe,
    >
    > That works fine in the code I posted but will not work when I use this
    > method when sending data via email using formmail.cgi - any idea what
    > to use there?


    try :

    \n\r

    or : \\n
    or : \\r
    or : \\n\\r


    --
    Stephane Moriaux et son [moins] vieux Mac
     
    ASM, Sep 13, 2005
    #3
  4. Geoff Cox

    Mick White Guest

    Geoff Cox wrote:

    > On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
    > <> wrote:
    >
    >
    >>>How do I get a carriage return after each of the names?!

    >>
    >>
    >>results += window["text_" + z] + ' <br>';

    >
    >
    > Zoe,
    >
    > That works fine in the code I posted but will not work when I use this
    > method when sending data via email using formmail.cgi - any idea what
    > to use there?
    >

    Try "\n" instead of <br> , your server should be able to handle it...
    Mick
     
    Mick White, Sep 13, 2005
    #4
  5. Geoff Cox

    Geoff Cox Guest

    On Tue, 13 Sep 2005 13:52:35 GMT, Mick White
    <> wrote:

    >Try "\n" instead of <br> , your server should be able to handle it...
    >Mick


    Mick

    I have and no go - have also tried String.fromCharCode() but stll
    cannot separate the parts of the string ... so that they start on new
    lines in the email sent by formmail-nms....

    Cheers

    Geoff
     
    Geoff Cox, Sep 13, 2005
    #5
  6. Geoff Cox

    Robi Guest

    ASM wrote in message news:4326d934$0$7852$...
    > Geoff Cox wrote:
    >> On Tue, 13 Sep 2005 09:57:16 GMT, Zoe Brown wrote:
    >>
    >>>How do I get a carriage return after each of the names?!
    >>>results += window["text_" + z] + ' <br>';

    >>
    >> Zoe,
    >>
    >> That works fine in the code I posted but will not work when I use this
    >> method when sending data via email using formmail.cgi - any idea what
    >> to use there?

    >
    > try :
    >
    > \n\r
    >
    > or : \\n
    > or : \\r
    > or : \\n\\r


    Stephane, either you're being ignored, or Geoff thinks you're saying
    the same as he already tried ;-)

    Geoff,

    \n = new line
    \r = carriage return

    you might want to try yhe latter or the combination of both - as in cr/nl

    HTH
     
    Robi, Sep 13, 2005
    #6
  7. Geoff Cox

    Geoff Cox Guest

    On Tue, 13 Sep 2005 15:48:29 +0200, ASM
    <> wrote:

    >try :
    >
    > \n\r
    >
    >or : \\n
    >or : \\r
    >or : \\n\\r


    Stephane

    I have tried all and no go!?

    Cheers

    Geoff
     
    Geoff Cox, Sep 13, 2005
    #7
  8. Geoff Cox

    ASM Guest

    Geoff Cox wrote:
    > On Tue, 13 Sep 2005 15:48:29 +0200, ASM
    > <> wrote:
    >
    >
    >>try :
    >>
    >> \n\r
    >>
    >>or : \\n
    >>or : \\r
    >>or : \\n\\r

    >
    >
    > Stephane
    >
    > I have tried all and no go!?



    Ha? yes ! you're right ! :-(

    try with : %0D%0A

    because that :

    <html>
    <a href="#" onclick="
    var asm = 'hello,%0D%0A%0D%0Athere is a little message to%0D%0Asee '+
    'if return carriages%0D%0Aare understood';
    alert(asm);
    location.href='mailto:?'+
    'subject=saluti a tuti&body='+asm;
    return false;
    ">mail</a>
    </html>

    works fine for me at home



    --
    Stephane Moriaux et son [moins] vieux Mac
     
    ASM, Sep 13, 2005
    #8
  9. Geoff Cox

    Geoff Cox Guest

    On Tue, 13 Sep 2005 21:02:50 +0200, ASM
    <> wrote:

    >Ha? yes ! you're right ! :-(
    >
    >try with : %0D%0A
    >
    >because that :
    >
    ><html>
    ><a href="#" onclick="
    > var asm = 'hello,%0D%0A%0D%0Athere is a little message to%0D%0Asee '+
    > 'if return carriages%0D%0Aare understood';
    > alert(asm);
    > location.href='mailto:?'+
    > 'subject=saluti a tuti&body='+asm;
    > return false;
    > ">mail</a>
    ></html>
    >
    >works fine for me at home


    Stephane,

    Thanks - will give it a try tomorrow - a bit late now - nearly 1am

    Cheers

    Geoff
     
    Geoff Cox, Sep 14, 2005
    #9
  10. Geoff Cox

    Geoff Cox Guest

    On Tue, 13 Sep 2005 13:52:35 GMT, Mick White
    <> wrote:

    >Try "\n" instead of <br> , your server should be able to handle it...


    Mick,

    Someone has given me the answer!

    I used escape()

    ie escape("\n")

    !!

    Cheers

    Geoff
     
    Geoff Cox, Sep 14, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ferdi
    Replies:
    5
    Views:
    4,730
    Jacob Yang [MSFT]
    Aug 24, 2003
  2. Kevin Spencer
    Replies:
    3
    Views:
    3,258
    Doc Wally
    Oct 11, 2003
  3. Xeno Campanoli
    Replies:
    0
    Views:
    246
    Xeno Campanoli
    Feb 13, 2006
  4. Mike O'Neal
    Replies:
    5
    Views:
    153
    Mike O'Neal
    Aug 12, 2003
  5. Steve Anderson
    Replies:
    3
    Views:
    277
    Steve Anderson
    Jun 21, 2004
Loading...

Share This Page