Suppose I have an asp page with a list box with several choices (A, B, C) and if a user selects a choice then another list box on that same page will be populated with certain information?
First thought would be to have a condition in your page that checks if a passed parameter is set (eg ShowList2=True) then when the condition is checked, populate the list with what you wish, possibly with other parameter values passed.
This requires pure JavaScript.. Load this into your browser, examine the script and you should be able to determine how it's done..
<html>
<head>
<script Language="JavaScript">
<!--
function populateList2(form_ref) {
if (form_ref.months.value == "" {
// IF "SELECT MONTH" IS SELECTED IN MONTHS LIST
form_ref.holidays.length = null
form_ref.holidays.options[0] = new Option("No Events Listed",""
} else {
// OTHERWISE EXAMINE SELECTION AND POPULATE 2ND LIST
if(form_ref.months.value == "12" {
// CLEAR THE LIST
form_ref.holidays.length = null
// ADD OPTIONS HERE
form_ref.holidays.options[0] = new Option("Christmas","xmas"
form_ref.holidays.options[1] = new Option("Christmas Eve","xmaseve"
form_ref.holidays.options[2] = new Option("New Years Eve","nyreve"
form_ref.holidays.options[3] = new Option("My Friends Birthday","joesbday"
}
if(form_ref.months.value == "4" {
// CLEAR THE LIST
form_ref.holidays.length = null
// ADD OPTIONS HERE
form_ref.holidays.options[0] = new Option("Good Friday","gfd"
form_ref.holidays.options[1] = new Option("Easter Sunday","esunday"
form_ref.holidays.options[2] = new Option("April Fools Day","apr1"
}
if(form_ref.months.value == "11" {
// CLEAR THE LIST
form_ref.holidays.length = null
// ADD OPTIONS HERE
form_ref.holidays.options[0] = new Option("PGA Skins Game","skins"
form_ref.holidays.options[1] = new Option("Thanksgiving","thxgvng"
}
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.