Forum Moderators: open
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 = "mailto:?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 -->
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 = "mailto:?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 -->
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 = "mailto:?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 = "mailto:?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 -->
<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.: m 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!
<a title="Bring company. Invite a friend."
href=
"mailto:?Subject=Check%20out%20this%20site%20I%20found&body=Your%20Web20site%20http://yourdomaine.com/">