This is a script which I use on my site:
<form name=”formindex”>
<select name=”options” size=”1″ onChange=”showtext()” >
<option value=”select” readonly>—select—</option>
<option value=”opt1″>Option1</option>
<option value=”opt2″>Option2</option>
<option value=”opt3″>Option3</option>
<option value=”opt4″>Option4</option>
</select>
<textarea rows=1 cols=25 wrap=”physical” name=”textarea”></textarea>
<script language=”javascript”>
var show=document.formindex
var textarea=new Array()
textarea[0]=”—“
textarea[1]=”Option1″
textarea[2]=”Option2″
textarea[3]=”Option3″
textarea[4]=”Option4″
function showtext(){
show.textarea.value=textarea[show.options.selectedIndex];
}
</script>
Its not THE actual script I use, but greatly condensed so that you have a rough idea of what I am doing. It works, and it is my first script. The reason I used this method to manipulate text area from selection is that I need four different text boxes to display different information depending on the option selected from the form (not shown here) so I have 4 different textbox variables which all pass a different value into each box.
What I need help with is passing a fifth value onto the page. I not only want the four text boxes populated, but I also want to display an image on the same page in either a fifth field on my form, or in a cell within the table that houses my form, and I presume it is something to do with ONCHANGE. Can anyone tell me how to do it?