Hi there,
I would like to embed a dropdown menu of countries, where a country is selected another dropdown menu appears with State/Province/County/Region, corresponding to the selected country. Would anyone please help me with a sample
Thanks
Hi there,
I would like to embed a dropdown menu of countries, where a country is selected another dropdown menu appears with State/Province/County/Region, corresponding to the selected country. Would anyone please help me with a sample
Thanks
That’s a huge amount of data. Just the country dropdown alone wil have about 250 entries in it.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” />
<title>Dynamic Dropdown List</title>
<script type=“text/javascript”>
<!–
var ddlOptionsdb = new Object();
// list of options for car model dropdownlist
ddlOptionsdb[“Ferrari”] = [{value:“Enzo”,text:“Enzo”},
{value:“Testarossa”,text:“Testarossa”}];
ddlOptionsdb[“Lamborghini”] = [{value:“Galardo”,text:“Galardo”},
{value:“Murcielago”,text:“Murcielago”}];
function setModel(chooser){
var lgCars = chooser.form.elements["dlCars"];
// empty previous settings
lgCars.options.length = 0;
// get chosen value to act as index to ddlOptionsdb hash table
var choice = chooser.options[chooser.selectedIndex].value;
var db = ddlOptionsdb[choice];
// insert default first item
lgCars.options[0] = new Option("-- please choose a model --", "-- please choose a model --", true, false);
if (choice != "-- please choose a model --") {
// loop through array of the hash table entry, and populate options
for (var i = 0; i < db.length; i++) {
lgCars.options[i + 1] = new Option(db[i].text, db[i].value);
}
// enable lgCars & give it focus
lgCars.disabled = false;
lgCars.focus();
}
else {
// disable lgCars
lgCars.disabled = true;
}
// cascade change to Model Type
setModelType(lgCars);
}
-->
</script>
</head>
<body>
<form name=“Form1” method=“post” id=“Form1”>
<select onchange=“setModel(this)”>
<option selected=“selected” value=“-- please choose a make --”>– please choose a make –</option>
<option value=“Ferrari”>Ferrari</option>
<option value=“Lamborghini”>Lamborghini</option>
</select>
<select name=“dlCars” id=“dlCars” disabled=“disabled”>
<option selected=“selected” value=“-- please choose a model --”>– please choose a model –</option>
</select>
</form>
</body>
</html>
Poulate the countries in the options tags, the State/Province/County/Region should be added in the JavaScript.
Good luck, let me have a copy when your done !
Thank you, will try and get you a copy. Thanks!