gwmbox
01-04-2011, 03:29 AM
Hi guys, I have a form that has three select options, e.g.
<h3>Number</h3>
<select id="options_number" name="option1" onchange="result();">
<option value='one' selected='selected'>One</option>
<option value='two' >Two</option>
<option value='three' >Three</option>
<option value='four' >Four</option>
<option value='five' >Five</option>
</select>
<h3>Condition</h3>
<select id="options_condition" name="option2" onchange="result();">
<option value='blind' >Blind</option>
<option value='dead' >Dead</option>
<option value='Healthy' selected='selected'>Healthy</option>
</select>
<h3>Animal</h3>
<select id="options_animal" name="option3" onchange="result();">
<option value='mice' selected='selected'>Mice</option>
<option value='rats' >Rats</option>
</select>
Each select is to provide a result individually, but I need to combine the results to get a final result, the end result will show a picture
I am thinking something like this but I am not really sure how to get the correct values and/or if my combining method is correct or not.
if (option1 == one && option2 == healthy && option3 == rats) {
document.getElementById('mypic').innerHTML = 'http://mine.com/3healthyrats.jpg';
} elseif (option1 == three && option2 == blind && option3 == mice) {
document.getElementById('mypic').innerHTML = 'http://mine.com/3blindmice.jpg';
} elseif .........
Thanks
GW
<h3>Number</h3>
<select id="options_number" name="option1" onchange="result();">
<option value='one' selected='selected'>One</option>
<option value='two' >Two</option>
<option value='three' >Three</option>
<option value='four' >Four</option>
<option value='five' >Five</option>
</select>
<h3>Condition</h3>
<select id="options_condition" name="option2" onchange="result();">
<option value='blind' >Blind</option>
<option value='dead' >Dead</option>
<option value='Healthy' selected='selected'>Healthy</option>
</select>
<h3>Animal</h3>
<select id="options_animal" name="option3" onchange="result();">
<option value='mice' selected='selected'>Mice</option>
<option value='rats' >Rats</option>
</select>
Each select is to provide a result individually, but I need to combine the results to get a final result, the end result will show a picture
I am thinking something like this but I am not really sure how to get the correct values and/or if my combining method is correct or not.
if (option1 == one && option2 == healthy && option3 == rats) {
document.getElementById('mypic').innerHTML = 'http://mine.com/3healthyrats.jpg';
} elseif (option1 == three && option2 == blind && option3 == mice) {
document.getElementById('mypic').innerHTML = 'http://mine.com/3blindmice.jpg';
} elseif .........
Thanks
GW