[Javascript] mailto link question.

Robert Wall bob at web-walrus.com
Thu Oct 16 21:01:34 CDT 2003


> I came up with a very easy script that iterates through a form and
> concocts an email message, the body of which is the contents of all
> the form elements and their values. Unfortunately all the form fields
> and their values come out in a continuous string:
> FirstName=Joe,LastName=Blow etc. I tried putting "/r/n" after each
> form elemenr in rhe script but this doesn't help. Would any of you
> Javascript gurus have an idea how I can put a carriage return/line
> feed in the body of a mailto link?? I come from the Pascal world and
> Javascript is quite net to me at this point, this is for my nephew's
> Cub Scout troop's web site.

I'm assuming the continuous string is what's commonly referred to as URL
Encoding.  Spaces get encoded as either a + or a %20, all other odd
characters get encoded with a % and a hexadecimal number indicating the
character that was replaced.  This is the standard, correct output of a
form that uses the mailto method as it's action.

The traditional way to handle your situation is to pass the form stuff to
a CGI script, which handles the e-mailing.  There are a myriad of free CGI
scripts that handle such things, check out http://www.cgi-resources.com

If your server offers Perl functionality, get a Perl script and play with
it.  You'll love Perl if you're used to Pascal.  :)

-----
Robert Wall						(715) 855-0189
Systems Administrator                                   bob at web-walrus.com
Web Walrus Media

            "Affordable internet solutions for your business"




More information about the Javascript mailing list