<form ac&on="mailto:username@jhu.edu" method="post" enctype="text/plain">
Let s debug some code together: hkp://www.clsp.jhu.edu/~anni/cs103/test_before.html hkp://www.clsp.jhu.edu/~anni/cs103/test_arer.html
<body> <form ac&on="mailto:username@jhu.edu" method="post" enctype="text/plain"> <form> First name: <input type="text" name="firstname" /> Last name: <input type="text" name="lastname" /> <br> Gender: <select name="gender" id="g1" mul&ple="mul&ple" size="2"> <op&on value="male">male</op&on> <op&on value="female">female</op&on> </select> <input type="bukon" value="submit" onclick="displaymsg(this.form)" /> </form> </body>
<body> <form> First name: <input type="text" name="firstname" /> Last name: <input type="text" name="lastname" /> <br> Gender: <select name="gender" id="g1" mul&ple="mul&ple" size="2"> <op&on value="male">male</op&on> <op&on value="female">female</op&on> </select> More control if you write the ac&on yourself: <input type="bukon" value="submit" onclick="displaymsg(this.form)" /> </form> </body>
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" +
Name of func&on document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" +
arguments document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" +
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + string = sum of other strings
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + example: Name: Ann Irvine Gender: Female
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + Pop up a window with the content of the message
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + If the window is confirmed
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + call the func&on called mailto
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + Pass it two arguments
document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + Receive two arguments
string = sum of other strings document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" +
string = sum of other strings document.loca&on.href = +
document.loca&on.href = + Dynamically load a page with this address
document.loca&on.href = + Details: semicolons
document.loca&on.href = + Details: Brackets
document.loca&on.href = + Details: javascript tags
document.loca&on.href = +
<body> <form> First name: <input type="text" name="firstname" /> Last name: <input type="text" name="lastname" /> <br> Gender: <select name="gender" id="g1" mul&ple="mul&ple" size="2"> <op&on value="male">male</op&on> <op&on value="female">female</op&on> </select> <input type="bukon" value="submit" onclick="displaymsg(this.form)" /> </form> </body> document.loca&on.href = +
<html> <head> <script type="text/javascript > document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + </head> <body> <form> First name: <input type="text" name="firstname" /> Last name: <input type="text" name="lastname" /> <br> Gender: <select name="gender" id="g1" mul&ple="mul&ple" size="2"> <op&on value="male">male</op&on> <op&on value="female">female</op&on> </select> <input type="bukon" value="submit" onclick="displaymsg(this.form)" /> </form> </body> </html> All of the javascript stuff
<html> <head> <script type="text/javascript > document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + </head> <body> <form> First name: <input type="text" name="firstname" /> Last name: <input type="text" name="lastname" /> <br> Gender: <select name="gender" id="g1" mul&ple="mul&ple" size="2"> <op&on value="male">male</op&on> <op&on value="female">female</op&on> </select> <input type="bukon" value="submit" onclick="displaymsg(this.form)" /> </form> </body> </html> Form stuff All of the javascript stuff
<html> <head> <script type="text/javascript > document.loca&on.href = "mailto:kenneth.church@jhu.edu" + "?subject=" + subj + "&body=" + </head> <body> <form> First name: <input type="text" name="firstname" /> Last name: <input type="text" name="lastname" /> <br> Gender: <select name="gender" id="g1" mul&ple="mul&ple" size="2"> <op&on value="male">male</op&on> <op&on value="female">female</op&on> </select> <input type="bukon" value="submit" onclick="displaymsg(this.form)" /> </form> </body> </html> Form stuff All of the javascript stuff Use the javascript to email the form content
Fix up some more code together (if &me): hkp://www.clsp.jhu.edu/~anni/cs103/test2_before.html hkp://www.clsp.jhu.edu/~anni/cs103/test2_arer.html
Next Up: Programming Phone Menus hkps://studio.tellme.com/
Homework 1. Make sure you have a working javascript based survey on your website: You should have func&ons like and (don t rely on the html ac&on tag that does this automa&cally and not so well) Don t worry about radio bukons and checkboxes, they re harder Include just textboxes and/or select lists 2. We ll learn how to do this in a much easier way with Google Docs later 3. Go to hkps://studio.tellme.com/ and sign up for a free account. Play around if you have &me, but at least have an account ready to program by next Tuesday