CEdmeades
01-13-2004, 08:53 AM
Hi, I will try and explain my problem the best I can.
Basically, I'm trying to set up a form that emails the entered fields to my email address but I can't separate the four lines that go in the body of the message.
function createBody(){
a = "Sales Code of "+document.requestForm.name.value+": "+document.requestForm.repcode.value;
b = "Stationary to be ordered: "+document.requestForm.stationary.value;
c = "Quantity required: "+document.requestForm.quantity.value;
d = "Reason given: "+document.requestForm.reason.value;
result = a +"\n"+ b +"\n"+ c +"\n"+ d
return result}
this is the function that creates the body of the email. When I put alert(result) it has each variable on separate lines. When I then try to put it into the body of an email:
window.location = "mailto:"+u+"?subject="+m+"&body="+createBody();
"u" and "m" are just the recipient and subject variables...
it puts the body all on one line. How do I fix this? I've thought making the createBody() function return a variable with HTML coding but I don't know how to make the email encoded in HTML (just puts the code in plain text).
On another note, what expression can i use instead of window.location=... so that it automatically sends the email without bringing up the outlook dialog box, requiring me to click send manually.
THANKYOU IF YOU CAN HELP!!!
Cam
Basically, I'm trying to set up a form that emails the entered fields to my email address but I can't separate the four lines that go in the body of the message.
function createBody(){
a = "Sales Code of "+document.requestForm.name.value+": "+document.requestForm.repcode.value;
b = "Stationary to be ordered: "+document.requestForm.stationary.value;
c = "Quantity required: "+document.requestForm.quantity.value;
d = "Reason given: "+document.requestForm.reason.value;
result = a +"\n"+ b +"\n"+ c +"\n"+ d
return result}
this is the function that creates the body of the email. When I put alert(result) it has each variable on separate lines. When I then try to put it into the body of an email:
window.location = "mailto:"+u+"?subject="+m+"&body="+createBody();
"u" and "m" are just the recipient and subject variables...
it puts the body all on one line. How do I fix this? I've thought making the createBody() function return a variable with HTML coding but I don't know how to make the email encoded in HTML (just puts the code in plain text).
On another note, what expression can i use instead of window.location=... so that it automatically sends the email without bringing up the outlook dialog box, requiring me to click send manually.
THANKYOU IF YOU CAN HELP!!!
Cam