codice:
<html>
<head>
<script>
//inizializzazione variabili
var regiondb = new Object()
regiondb["africa"] = [{value:"102", text:"Cairo"},{value:"88", text:"Lagos"},{value:"80", text:"Nairobi"},{value:"55", text:"Pretoria"}];regiondb["asia"] = [{value:"30", text:"Ankara"},{value:"21", text:"Bangkok"},{value:"49", text:"Pechino"},{value:"76", text:"New Delhi"},{value:"14", text:"Tokyo"}];
regiondb["australia"] = [{value:"64", text:"Suva"},{value:"12", text:"Sydney"}];
regiondb["europa"] = [{value:"11", text:"Atene"},{value:"35", text:"Francoforte"},{value:"3", text:"Londra"},{value:"15", text:"Madrid"},{value:"1", text:"Parigi"},{value:"10", text:"Roma"},{value:"6", text:"Stoccolma"},{value:"97", text:"San Pietroburgo"}];
regiondb["noamer"] = [{value:"73", text:"Dallas"},{value:"71", text:"Los Angeles"},{value:"5", text:"New York"},{value:"37", text:"Toronto"}];
regiondb["suamer"] = [{value:"65", text:"Buenos Aires"},{value:"31", text:"Caracas"},{value:"66", text:"Rio di Janeiro"}];
//funzioni
function setCities(chooser) {
var newElem;
var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
var cityChooser = chooser.form.elements["citta"];
while (cityChooser.options.length) {
cityChooser.remove(0);
}
//qui si dichiara il nome della seconda select(quella dinamica)
var choice = chooser.options[chooser.selectedIndex].value;
//
var db = regiondb[choice];
newElem = document.createElement("option");+
// qui si sceglie il contenuto della seconda select (quella dinamica)
newElem.text = "Seleziona una città:";
newElem.value = "";
cityChooser.add(newElem, where);
if (choice != "") {
for (var i = 0; i < db.length; i++) {
newElem = document.createElement("option");
newElem.text = db[i].text;
newElem.value = db[i].value;
cityChooser.add(newElem, where);
</script>
</head>
<body>
<form name="form">
Invia la richiesta a:
<select name="continente" onchange="setCities(this)">
<option value="" selected="selected">Seleziona un
continente:</option> <option value="africa">Africa</option>
<option value="asia">Asia</option>
<option value="australia">Australia/Oceania</option>
<option value="europa">Europa</option>
<option value="noamer">Nord America</option>
<option value="suamer">Sud America</option>
</select>
<select name="citta">
<option value="" selected="selected">Seleziona una città:</option>
</select>
</form>
</body>
</html>
solo che nn mi funziona e sulla spiegazione mi dice: