I'm trying to change images that appear in table cells based on two select menus. I know how to get the options from the select menu and test it thru if statemtents. How do I switch images in cells. Here's what I've gotten so far:
- PHP: Select all
<head>
<script type="text/JavaScript">
function do_this()
{
var optionOne = document.form1.selectOne.value;
var optionTwo = document.form1.selectTwo.value;
if(optionOne == "1" && optionTwo == "a")
{
//replace the image in cell_1 with another image
}
else if(optionOne == "1" && optionTwo == "b")
{
//replace the image in cell_2 with another image
}
</script>
</head>
<body>
<table border=1>
<form name="form1">
<tr>
<td><select name=selectOne>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option></select></td>
<td><select name=selectTwo>
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option></select></td>
</tr>
<tr height=50>
<td width=150 id="cell_1"><img src="IMAGE1"></td>
<td width=150 id="cell_2"><img src="IMAGE2"></td>
</tr>
<tr>
<td colspan=2><input type=button value="submit" onclick="do_this()"></td>
</tr>
</form>
</table>
</body>
What goes in the if statemtents to switch an image in a cell?
Thanks for the help!