Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2004, 01:16 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Variables

Hey,

Anyone know if you can pass variables within a form to an e-mail body?

This is more or less what I have codewise:

<form name ="form1">
<BR>
<input type ="text" name ="yourname"><BR>
<input type ="button" name ="passtobody" value ="Pass to Body" onclick ="pass_variable_to_body()">
</form>
<script language ="javascript">
function pass_variable_to_body(){
var bodyvar=document.form1.passtobody.value
location.href="mailto:me@mydomain.com&subject=What ever&body=howthehelldo I get the value of the variable called bodyvar to appear here"
</script>

__________________
\'sync\' &lt;cr&gt;
The name specified is not recognized as an internal or external command, operable program or batch file.
 
Old June 28th, 2004, 01:19 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry, forgot there should be a "}" at the end of the script.

interrupt

 
Old June 28th, 2004, 04:22 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Try this:

location.href="mailto:me@mydomain.com?subject=What ever&body="+bodyvar;

HTH,

Snib

<><
 
Old June 29th, 2004, 07:00 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brilliant!

Quote:
quote:Originally posted by Snib
 Try this:

location.href="mailto:me@mydomain.com?subject=What ever&body="+bodyvar;

HTH,

Snib

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variables from 1 form to another. jainin_shah9 C# 10 February 18th, 2008 07:59 PM
Grabbing form variables jroxit Classic ASP Basics 5 June 18th, 2007 05:08 PM
Saving form variables after a reload, rinventive Pro PHP 8 June 23rd, 2006 04:49 AM
Submitting a form via a link with variables mswombat Classic ASP Basics 5 November 6th, 2005 06:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.