text: var stateObject = {
      "California": {
          "Monterey": ["Salinas", "Gonzales"],
          "Alameda": ["Oakland", "Berkeley"]
      },
      "Oregon": {
          "Douglas": ["Roseburg", "Winston"],
          "Jackson": ["Medford", "Jacksonville"]
      }
  }
  window.onload = function () {
      var stateSel = document.getElementById("stateSel"),
          countySel = document.getElementById("countySel"),
          citySel = document.getElementById("citySel");
      for (var state in stateObject) {
          stateSel.options[stateSel.options.length] = new Option(state, state);
      }
      stateSel.onchange = function () {
          countySel.length = 1; // remove all options bar first
          citySel.length = 1; // remove all options bar first
          if (this.selectedIndex < 1) return; // done
          for (var county in stateObject[this.value]) {
              countySel.options[countySel.options.length] = new Option(county, county);
          }
      }
      stateSel.onchange(); // reset in case page is reloaded
      countySel.onchange = function () {
          citySel.length = 1; // remove all options bar first
          if (this.selectedIndex < 1) return; // done
          var cities = stateObject[stateSel.value][this.value];
          for (var i = 0; i < cities.length; i++) {
              citySel.options[citySel.options.length] = new Option(cities[i], cities[i]);
          }
      }
  }
  