Mailto question

J

Joh

I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?

"<script
language='javascript'>window.open('mailto:&body=http://www.abc.com/test.aspx?Name=abc&[email protected]',
'_blank');</script>"
 
P

pcx99

Joh said:
I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?

"<script
language='javascript'>window.open('mailto:&body=http://www.abc.com/test.aspx?Name=abc&[email protected]',
'_blank');</script>"

mailto://[email protected]?body=http://www.abc.com/test.aspx&Name=abc&subject=a
subject!

You didn't ask for it, but I added in a subject too, you can delete it
(&subject...) if you decide not to use it.

Hope that helps you out a bit.
 
J

Joh

pcx99 skrev:
mailto://[email protected]?body=http://www.abc.com/test.aspx&Name=abc&subject=a
subject!

You didn't ask for it, but I added in a subject too, you can delete it
(&subject...) if you decide not to use it.

Hope that helps you out a bit.
Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.
 
J

Joh

Joh skrev:
pcx99 skrev:

Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.


Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

"<script
language='javascript'>window.open('mailto:&body=http://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"
 
P

pcx99

Joh said:
Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.


Ah, that's because the & in the url is getting mixed up with the mailto
address. Basically mailto is using & to separate data and the url you
have for the body is also using & to separate its data. So the solution
is to escape the data like this...

<script language='javascript'>

window.open('mailto:abc.com?body='+escape('http://www.abc.com/test.aspx?Var1=abc&Var2=123'),
'_blank');

</script>

The escape command basically will change all the spaces, ampersighns,
question marks and other special symbols into "safe" codes.

Hope that works a little better for you.
 
R

Randy Webb

Joh said the following on 12/16/2006 7:26 AM:
Joh skrev:



Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

"<script
language='javascript'>window.open('mailto:&body=http://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"

Instead of &, try &amp;
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top