[Javascript] mailto link question.

Stone, Timothy tstone at cityofhbg.com
Fri Oct 17 15:05:20 CDT 2003


Eureka...you need to *encode* your string that you are creating. 

Where ever you encounter, or need a "carriage return," insert the
Unicode value of (no quotes) "\u000d" (i.e. char(13) in VB, \r\n in DOS,
\n in Java).

*Then* escape the string to encode it.

    <script type="text/javascript" language="javascript">
        var myString = "Now is the time for all good
men...\u000dHohohoho";

        myString = escape( myString ); //part of the javascript core

        alert( myString );

    </script>

Hope this helps.

Tim

> -----Original Message-----
> From: mercer.b at comcast.net [mailto:mercer.b at comcast.net] 
> Sent: Thursday, October 16, 2003 9:59 PM
> To: javascript at LaTech.edu
> Subject: [Javascript] mailto link question.
> 
> 
> Hello all!
> 
> 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.
> 
> Many Tnanks.
> Brian M.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu 
> https://lists.LaTech.edu/mailman/listinfo/java> script
> 



More information about the Javascript mailing list