Jump to content

Using Conditionals and innerHTML with Multiple Form Values?


paulmo

Recommended Posts

From the following 2 form fields, I need to post message (not alert) to user on same page; like if they click Small and Mellow (0 and 3), then "A turtle might be a good pet." I'm seeing conditionals in here but need help getting started. New to JavaScript. Please help get me on my way:

<form name="size" method="post" action="markup-turbo.html"><select name="size"><option selected="size">Size</option><option value="0">Small < 30 lbs.</option><option value="1">Medium < 65 lbs.</option><option value="2">Large > 65 lbs.</option></select><select name="temperament"><option selected="temperament">Temperament</option><option value="3">Mellow</option><option value="4">Spirited</option></select><input type="submit" value="Process" //was using this for testing onClick="test(this.form)"></form>//this is where I'm stuck! <script>document.getElementById(// I think I need some kind of conditional/loop in here, not the name,"temperament" + "size".).innerHTML </script>

Link to comment
Share on other sites

You'll probably want to create several arrays to hold the different things. Have an array for each size, and an array for each temper. Once they pick, loop through the arrays to find the items that appear in both. In set theory that's called an intersection:http://www.google.com/search?client=opera&...-8&oe=utf-8

Link to comment
Share on other sites

Thanks JSG, was hoping to catch your attention. I'll follow up with that lead and post back here with results. On an unrelated note, after teaching English for 10 years, I'm taking College Algebra class at my local CC to hopefully get something of the brain you've got. So I appreciate the intersection-set theory gloss.

Link to comment
Share on other sites

Thanks JSG, was hoping to catch your attention. I'll follow up with that lead and post back here with results. On an unrelated note, after teaching English for 10 years, I'm taking College Algebra class at my local CC to hopefully get something of the brain you've got. So I appreciate the intersection-set theory gloss.
this might be cheaper... :)http://www.youtube.com/watch?v=NOe_4mgmyyA
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...