Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Drop Down Menu 1

Status
Not open for further replies.

sunsetbay

Technical User
Aug 5, 2002
19
AU
Hey Experts,

I know this can be done easily and hoping someone can help me out with this html script here!

/<form>
/Type of Data: <select><option>Type of Cover</option>
<option>Age Group</option>
/By: <select><option>All Class</option>
<option>Saver</option>
<option>Flexi Plus</option>
<option>Platinum</option>
/<Input type="submit" value="View" />
/</form>

Basically what I want to do is when a user select "Type of Cover", then the form "By:" will generate a drop down menu of "Saver", "Flexi Plus", "Platinum". however on the other hand, if the user select "Age Group", the form "By:" will generate ">25 year old" , "26 - 40year old", "41 - 60year old". ...

Does anyone know how to change this?

Thanks for your help in advance!

Cheers
Yennie

~~I live to die and Die to Live~~
 
You'll need Javascript.

The easiest way would be to have 2 drop downs with the corresponding values and then show/hide the appropriate one depending on what is selected.

Kind of like this:

Code:
<html>
<head>
<script>
function show_drop(mydrop){
if(mydrop.value==1){
document.getElementById('cover').style.display='block';
document.getElementById('agegroup').style.display='none';
}
if(mydrop.value==2){
document.getElementById('agegroup').style.display='block';
document.getElementById('cover').style.display='none';
}


}
</script>
<body>
<select name="type" onChange="show_drop(this);">
<option>----</option>
<option value=1>Type of Cover</option>
<option value=2>Age Group</option>
</select>

<select name="agegroup" id="agegroup" style="[red]display:none;[/red]">
<option> > 25 </option>
<option>26-40 </option>
<option>41-60</option>
</select>

<select name="cover" id="cover" style="[red]display:none;[/red]">
<option>Saver</option>
<option> Flexiplus</option>
<option>Platinum</option>
</select>


</body>
</html>


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top