I am trying to make a form, with a textbox next to a select box. When the user selects an option in the select I would like the textbox to display some text to explain what each select option means. I have this so far: (I have left out anything unrelated to the problem)
<script>
if(document.getElementById("list01").value=="burn")
{
document.getElementById("favorite").value="This burns their crops"
}
if(document.getElementById("list01").value=="pillage")
{
document.getElementById("favorite").value="Kill women and children"
}
if(document.getElementById("list01").value=="court")
{
document.getElementById("favorite").value=""
}
</script>
<form id="myform" method="post"> how would you like to attack <? echo $attuser; ?>, you can:<br /><br />
<select id="list01" name="atk" class="but" onChange="explain(this)">
<option value="burn">burn crops</option>
<option value="pillage">pillage</option>
<option value="court">court women</option></select><input id="exp" value="" disabled="disabled" class="but" size="50" />
<input type="submit" name="attack" value="Attack!!" class="but" />
</form><br />
The above code doesnt work, could someone tell me where i have gone wrong please.
Thanks in advance for your any help