View Full Version : Drop Down Messages

09-03-2006, 10:01 PM
I was looking at the following script from http://www.javascriptkit.com and came across a small problem.

Script Reference: http://www.javascriptkit.com/script/script2/combomessage.shtml

It works fine, it's just that I would like to know how I can add more than one field to alter when a different item is selected from the drop down menu.
For example;
When you have "What is JavaScript?" selected, as well as displaying the definition; it displays in a separate text area an example of JavaScript.

Then when you change the option to "What is DHTML?", both values in the text areas change accordingly.

Any help on the issue is appreciated,

09-06-2006, 02:53 PM
This is a short example may help you out.

<script language="javascript">
text[0] = 'first text';
text[1] = 'second text';
text[2] = 'third text';
text[3] = 'forth text';
<select onchange="document.getElementById('test').value = text[this.value];">
<option value='0'>First
<option value='1'>Second
<option value='2'>Third
<option value='3'>Forth
<div id="test"></div>