Forum Moderators: open

Message Too Old, No Replies

Send to friend

         

Dexie

1:00 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



I use the code below, and it's ok, but does anyone know a way for a few empty lines to appear at the bottom of the email text? So that the sender can easily put their text in without going to a certain place in the email and pressing returns.

I did try putting %0D%0A%0D%0A at the bottom of the code, but it threw up errors ;-(

Any help much appreciated.

<!-- hide script from old browsers

function mailpage()
{
mail_str = "&#109;&#097;&#105;&#108;&#116;&#111;:?subject=" + document.title;
mail_str += "&body=Hi,%0D%0A%0D%0AJust came across this website page and thought you might like to see it.%0D%0A%0D%0A" + document.title;
mail_str += ".%0D%0A%0D%0A" + location.href;
location.href = mail_str;
}

// end hiding script from old browsers -->

johnl

2:25 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Hi,
at least with ie6 the following works well and adds 2 linefeeds and some text after the url:


{
..
..
mail_str += ".%0D%0A%0D%0A" + location.href;
// adding some linefeeds here works well:
mail_str += "%0D%0A%0D%0A2 more linefeeds added..";
location.href = mail_str;
}

Hope it helps.

Dexie

2:51 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Many thanks John.

I'm a bit of a newb to js, so please bear with me - where exactly in the code below would it go please?

<!-- hide script from old browsers

function mailpage()
{
mail_str = "&#109;&#097;&#105;&#108;&#116;&#111;:?subject=" + document.title;
mail_str += "&body=Hi,%0D%0A%0D%0AJust came across this website page and thought you might like to see it.%0D%0A%0D%0A" + document.title;
mail_str += ".%0D%0A%0D%0A" + location.href;
location.href = mail_str;
}

// end hiding script from old browsers -->

johnl

3:20 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



hi,

just add my line:


mail_str += "%0D%0A%0D%0A2 more linefeeds added..";

before your line:

location.href = mail_str;

Dexie

3:41 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Many thanks again John.

Have you tried that script?

I've tried your version and another version below, but both put loads of blank lines *before* the url that appears in the email ;-( rather than blank lines *after* of all of the text.

<!-- hide script from old browsers

function mailpage()
{
mail_str = "&#109;&#097;&#105;&#108;&#116;&#111;:?subject=" + document.title;
mail_str += "&body=Hi,%0D%0A%0D%0AJust came across this website page and thought you might like to see it.%0D%0A%0D%0A" + document.title;
mail_str += ".%0D%0A%0D%0A" + location.href;
mail_str += "%0D%0A%0D%0A2 more linefeeds added..";
location.href = mail_str;
}

// end hiding script from old browsers -->

<!-- hide script from old browsers

function mailpage()
{
mail_str = "&#109;&#097;&#105;&#108;&#116;&#111;:?subject=" + document.title;
mail_str += "&body=Hi,%0D%0A%0D%0AJust came across this website page and thought you might like to see it.%0D%0A%0D%0A" + document.title;
mail_str += ".%0D%0A%0D%0A" + location.href;
location.href = mail_str;
mail_str += "%0D%0A%0D%0A2 more linefeeds added..";
}

// end hiding script from old browsers -->

johnl

8:55 am on Nov 23, 2005 (gmt 0)

10+ Year Member



Ok, here is my HTML with which i tested it and which works at least with IE6 and Outlook:


<html>
<head>
<title>WebmasterWorld91_4714.html</title>
<script LANGUAGE="JavaScript">

function MailPage()
{
var mail_str;

mail_str = "?subject=" + document.title;

mail_str += "&body=Hi,%0D%0AJust came across this website page and thought you might like to see it:" + document.title;
mail_str += "%0D%0A" + location.href;
mail_str += "%0D%0A%0D%0A%0D%0Atwo LFs added above";

location.href = "mailto:" + mail_str;

}
</script>
</head>

<body>
<form>
<INPUT type='button' id='jlbu' value='MailPage' onClick='MailPage();' style='{background-color: red;}'>
<form>
</body>
<pre>

</html>

But: keep in mind that different mail-programs might or might not interpret the entities (e. g.: &#109; as 'm') correctly. Therefore I have coded the "mailto:" explicitly. So you are in for a lot of tests, if you want to have this script working universally.

Good Luck!

topsites

2:16 am on Dec 7, 2005 (gmt 0)



I use straight html link for this...

<a title="Bring company. Invite a friend."
href=
"mailto:?Subject=Check%20out%20this%20site%20I%20found&amp;body=Your%20Web20site%20http://yourdomaine.com/">

Dexie

7:17 am on Dec 7, 2005 (gmt 0)

10+ Year Member



Apologies John, I feel bad, you took the trouble of doing the code for me, but due to family stuff going on, I haven't had chance to implemement it, but will within the next few days and will let you know how I got on.

Dex.