I half-wrote some code for a javascript survey that I have to send out for my 8th grade term paper and I can't seem to get it to work. Whenever I try and test send it Outlook gives me a weird error sayiing that it can't send the results to gangsuvey@hotmail.com+ADRESS, (gangsurvey@hotmail.com was the adress I set up to collect info on) so If any of you JS gurus out their see some obvious error with the code I would appreciate it if you could tell me. Thanks.
<html>
<head>
<title>
Gangs Survey
</title>
<script language="JavaScript">
<!-- Hide from old browsers
function survey() {
var i = 0
var index1=document.form1.answer1.selectedIndex
var index2=document.form1.answer2.selectedIndex
var index3=document.form1.answer3.selectedIndex
var index4=document.form1.answer4.selectedIndex
var result1=document.form1.answer1.options[index1].value
var result2=document.form1.answer2.options[index2].value
var result3=document.form1.answer3.options[index3].value
var result4=document.form1.answer4.options[index4].value
var comments=document.form1.comments.value
if (result1!=0 && result2!=0 && result3!=0){
document.mail.question1.value = result1
document.mail.question2.value = result2
document.mail.question3.value = result3
document.mail.question4.value = result4
document.mail.comment.value = comments
return true;}
else {
alert("Please fill out all questions. Thank you."); return false;}
}
// -->
</script>
</head>
<h1>Gangs Survey</h1>
<h5>Hello. My name is Daniel Portin, a student at Shahala Middle School.<br>For my 8th grade term paper I decided to research gangs in<br>the Pacific Northwest. It would be very helpfull to me<br>(to fullfill one of the requirments) if you could take the time to fill out the survey.<p><p><p><p><p><p></h5>
<body>
<FORM NAME="form1">
<STRONG>What area of work are you involved in?<br></STRONG>
<SELECT NAME="answer1" SIZE=1>
<OPTION SELECTED VALUE="0">-- Choose an answer --
<OPTION VALUE="ANSWER #1">Law Enforcement
<OPTION VALUE="ANSWER #2">Medical
<OPTION VALUE="ANSWER #3">Public/Civil Services
<OPTION VALUE="ANSWER #4">Food Services
<OPTION VALUE="ANSWER #5">Grocer/Teller
<OPTION VALUE="ANSWER #6">Other
<OPTION VALUE="ANSWER #7">Unemployed/Under 16
</SELECT><BR><BR>
<STRONG>How old are you?<br></STRONG>
<SELECT NAME="answer2" SIZE=1>
<OPTION SELECTED VALUE="0">-- Choose an answer --
<OPTION VALUE="ANSWER #1">13 to 17
<OPTION VALUE="ANSWER #2">18 to 29
<OPTION VALUE="ANSWER #3">30 to 49
<OPTION VALUE="ANSWER #4">Over 50
</SELECT><BR><BR>
<STRONG>Please rate the gang problem in your area<br>on a scale of 1 to 10, with 1 being the<br>lowest and 10 being the highest.<br></STRONG>
<SELECT NAME="answer3" SIZE=1>
<OPTION SELECTED VALUE="0">-- Choose an answer --
<OPTION VALUE="ANSWER #1">1
<OPTION VALUE="ANSWER #2">2
<OPTION VALUE="ANSWER #3">3
<OPTION VALUE="ANSWER #4">4
<OPTION VALUE="ANSWER #5">5
<OPTION VALUE="ANSWER #6">6
<OPTION VALUE="ANSWER #7">7
<OPTION VALUE="ANSWER #8">8
<OPTION VALUE="ANSWER #9">9
<OPTION VALUE="ANSWER #10">10
</SELECT><BR><BR>
<STRONG>What type of criminal activity would you<br>most attribute to gangs in your area?<br></STRONG>
<SELECT NAME="answer4" SIZE=1>
<OPTION SELECTED VALUE="0">-- Choose an answer --
<OPTION VALUE="ANSWER #1">Murder/Homocide
<OPTION VALUE="ANSWER #2">Jumpings/Muggings
<OPTION VALUE="ANSWER #3">Graffiti
<OPTION VALUE="ANSWER #4">Robbery/Armed Robbery
<OPTION VALUE="ANSWER #5">Drug Possession/Selling
<OPTION VALUE="ANSWER #6">Other
</SELECT><BR><BR>
<STRONG>Please describe the gang problem in your area?<br></STRONG><BR>
<TEXTAREA NAME="comments" ROWS=5 COLS=50></TEXTAREA>
</FORM>
<FORM NAME="mail" method="POST" action="mailto:gangsurvey@hotmail.com
?subject=Survey Results" onSubmit="return survey()"
enctype="multipart/form-data">
<input type=hidden name="question1">
<input type=hidden name="question2">
<input type=hidden name="question3">
<input type-hidden name="question4">
<input type=hidden name="comment">
<INPUT TYPE="SUBMIT" VALUE="Submit Survey!">
</FORM>
</body>
</html>