Click to See Complete Forum and Search --> : Mailto Function error


anniebelle82
01-29-2006, 10:35 PM
I'm tyring to implement a page whereby users can request a quote from the website.

So far, the email function is working perfectly, except for one tiny mistake where it keeps adding a '?' at the end of the subject line.

Here is the code:
function mailOrder(obj) {
var str1='?subject=';
str1+=document.getElementById('ProductCode').innerHTML;
str1+='%20';
str1+=document.getElementById('ProductName').innerHTML;
obj.href+=str1;

var str='?&body=';
str+=document.getElementById('ProductCode').innerHTML;
str+='%20';
str+=document.getElementById('ProductName').innerHTML;
str+='%0A'
str+='%0A'
str+='Please specify the quantity, colour and sizes required for this product.'
str+='%0A'
str+='%0A'
str+='Remember to leave your name, email, telephone and other contact details.';
obj.href+=str;

Any suggestions?

ray326
01-29-2006, 11:04 PM
var str='?&body='; should be var str='&body=';.

anniebelle82
01-30-2006, 12:18 AM
I tried that, but that kills my code, nothing appears but the mailto email

ray326
01-30-2006, 01:49 PM
Don't take ALL the "?"s out! A query string looks like this:

?firstvar=value1&secondvar=value2&thirdvar=value3