Results 1 to 4 of 4
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Linebreaks in javascript

    I have produced a page that pulls entries from various fields and places them into an email ready to be sent to be sent. This basically comes from a small javascript I have written which looks like this:
    function msg()
    {document.email.action="mailto:"
    mailtoandsubject=((document.email.sendmail.value)+ '?subject=' +document.email.subject.value+'&body=' + document.email.address1.value +document.email.address2.value.....etc for the other fields.

    To clarify email is the form name, address1 and address2 are field names.

    I have created this on my PC at work which uses Outlook 2002 using a slightly different piece of code and then I realised that some of my users will be using Outlook Express and there I thought I would produce this code so that when the submitted the form the email would be formatted correctly. The above code just concantinates the string values. I therefore put n then b and then r between the valuesthinking these would produce line feeds and therefore produce the desired result, but alas no.

    I have tried to get Outlook Express (6) to produce text emails not HTML but the problem is still there.

    Has anybody got any ideas please?
    Jerry

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Linebreaks in javascript

    I tested the attached in Outlook. I don't have the energy to change my default mail client right now. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    I used % 0D and % 0A (without the space after the %) to force the line breaks. All three work in Outlook. How about OE?
    Attached Files Attached Files

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Linebreaks in javascript

    Thanks for this.

    Yep, your page works for Outlook fine but when I ran it on my laptop which runs on OE6 ,it didn't like strings that contained but the
    did work.

    The next frustrating thing is that if I then place the field refs in the string ie. ..... '&body=' + document.e_mail.address1.value +
    +
    document.e_mail-address2.value....etc it puts up a message stating "runtime error
    not defined"
    , if I then put it in quotes it puts
    between the field values and then if I omit the + signs on either side it refuses to work.

    I know we are on the right lines here and our thinking is correct. Do you reckon it is a OE6 thing?

    Thanks again

    Jerry
    Jerry

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Linebreaks in javascript

    Can you re-post your code or make it an attachment? I can't understand what you're trying to do - it looks as though you are smashing two e-mail addresses together.

Posting Permissions

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