I created a survey and I need help making functions for it. I haven’t created a function yet because I obviously don’t know how to do it well yet. . I want the function to add 5 points for every A answer, 4 for for every B, 3 for C, 2 for D and 1 for the radio buttons. Also I want it to give a +1 score to every checkbox in question 5. For the last two questions I would like to create a function that will make the middle value +2 of the select objects, +1 for the second and fourth choices, and 0 for the first or fifth. Finally have all of these add up into the wellnes rating textbox.
Here is my outline of the code without the javascript added yet:
<head>
<title> Wellness Exam </title></head>
<center><h1> How Healthy Are You, Really? </h1>
<center><h2> The Results May Shock You </h2>
<body>
<form id=”survey” name=”survey”>
<p align=left>
<strong>1. Which one of the five choices best describes how often a week you exercise? </strong> <br><br>
<input type=”radio” name=”exercise” /> 6 or 7 <br>
<input type=”radio” name=”exercise” /> 4 or 5 <br>
<input type=”radio” name=”exercise” /> 2 or 3 <br>
<input type=”radio” name=”exercise” /> 1 <br>
<input type=”radio” name=”exercise” /> 0 <br>
<br>
<strong>2. Which one of these describes how many fast food meals you eat in a week? </strong><br><br>
<input type=”radio” name=”fastfood” /> 0 <br>
<input type=”radio” name=”fastfood” /> 1 to 3 <br>
<input type=”radio” name=”fastfood” /> 4 to 6 <br>
<input type=”radio” name=”fastfood” /> 7 to 9 <br>
<input type=”radio” name=”fastfood” /> More than 9 <br>
<br>
<strong>3. How many portions of fresh fruit of vegetables do you eat in a week? </strong> <br>
<input type=”radio” name=”fruit” /> Ten or more <br>
<input type=”radio” name=”fruit” /> 7 to 9 <br>
<input type=”radio” name=”fruit” /> 5 to 6 <br>
<input type=”radio” name=”fruit” /> 2 to 4 <br>
<input type=”radio” name=”fruit” /> one or less <br>
<br>
<strong>4.How often do you do your Web Page homework in a week? </strong> <br>
<input type=”radio” name=”homework” /> More than 5 <br>
<input type=”radio” name=”homework” /> 4 to 5 <br>
<input type=”radio” name=”homework” /> 3 <br>
<input type=”radio” name=”homework” /> 1 to 2 <br>
<input type=”radio” name=”homework” /> Zero <br>
<br>
<strong>5. Select the best courses you have taken: </strong><br>
<input type=”checkbox”> Web Design <br>
<input type=”checkbox”> Computer Operating Systems <br>
<input type=”checkbox”> Java Programming <br>
<br>
<strong>6. How much beer do you consume in a week? </strong> <br>
<select name=”beerconsumption”>
<option>None</option>
<option>1-2</option>
<option>3-5</option>
<option>6-9</option>
<option>10 or more</option></select>
<br><br>
<strong>7. How many glasses of red wine do you consume in a week? </strong> <br>
<select name=”wineconsumption”>
<option>None</option>
<option>1-2</option>
<option>3-5</option>
<option>6-9</option>
<option>10 or more</option></select>
<br><br>
</form>
<form id=maximum name=maximum>
<input type=button name=butt1 value=”Take a Deep Breath” onclick=maxcalc()><br>
<textarea rows=10 cols=50 name=outarea></textarea><br>Your Wellness Rating Message </a>
</form>