Re: email javascript

by "Bert" <bert(at)betterwebdesign.com.au>

 Date:  Thu, 28 Feb 2002 08:45:49 +0800
 To:  "Keith D Sellars" <Keith(at)webgraffix.com>,
<hwg-basics(at)hwg.org>
 References:  aol leapinliz kdsell
  todo: View Thread, Original
G'day

> Take a look at the following javascript code.  I am using this to allow
> viewers to "send this site to a friend".  What I want to do is be able to
> insert line breaks in the email box that pops up.  The page is located at
> www.helmetsunblocker.com if you want to see the existing code in action.

Better to do things like that with server-side scripting.

However, if you use "%0a%0d" instead of "\n", the mailto: hack will put line
breaks in the email (well, in some email programs anyway):

function mailpage()
{
mail_str = "mailto:?subject=HelmetSunblocker - 100% UV Protection: " +
document.title ;
mail_str += "&body= Look at this great new product
(www.helmetsunblocker.com) called a Helmet Sunblocker.%0a%0d"
mail_str += "This is one of the best riding investments you could ever make.
" + location.href + "%0a%0d";
location.href = mail_str;
}

HTH
--
Bert Doorn, Web Developer
CIW Associate, IWA Member
www.betterwebdesign.com.au
Fast Loading, User Friendly Websites

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA