Click to See Complete Forum and Search --> : changing content based on drop down menu selections


supergreg
12-08-2003, 04:40 PM
Does anyone have a script that would be able to allow an end-user to select up to 3 values from a drop down menu and automatically display a text string based on the selected value from the drop down menu?

Details:

Input: 3 Drop Drop Down Menus (Each drop down representing a different product)
Choices for each menu are:
> 1 year term
> 2 year term
> 3 year term
Event required: onChange

Output: text string
> Has to be displayed within a table cell (could be in a div, span or some other element) that is next to the associated product drop down menu
> I do not want it to be displayed in TEXT INPUT field

Heard or seen anything like this?
Much appreciated!

:rolleyes:

fredmv
12-08-2003, 04:53 PM
If your teacher asks, I didn't help you with this... :rolleyes: :D<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>untitled</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
</head>
<body>
<form action="#">
<div>
<select onchange="if(selectedIndex!=0)document.getElementById('t').innerHTML=options[selectedIndex].value;">
<option value="">&lt; select an option &gt;</option>
<option value="term 1">term 1</option>
<option value="term 2">term 2</option>
<option value="term 3">term 3</option>
</select>
</div>
</form>
<div id="t"></div>
</body>
</html>

supergreg
12-08-2003, 05:12 PM
You answered it exactly! Thank you very much.

fredmv
12-08-2003, 05:13 PM
You're very welcome. :D