コードコピーは次のとおりです。
<select id = "citylist">
<id = "selectid">を選択します
<オプション値= "0"> 0 </option>
</select>
<スクリプト>
var selectobj = document.getElementById( 'SelectID');
//オブジェクトからオプションを追加します
selectid.add(new option( "first"、 "1"))
selectid.add(new option( "second"、 "2"))
// IDでオプションを追加します
selectid.add(new option( "third"、 "3"))
selectid.add(new option( "fourth"、 "4"))
// IDを介してメソッドを追加します(オブジェクトを介してメソッドを追加することもできます)
selectid.onchange = function(){
//オブジェクトを介して値とテキストを取得します
alert(selectobj.value);
alert(selectobj.options [selectobj.selectedindex] .text);
// IDを介して値とテキストを取得します
アラート(selectid.value);
alert(selectid.options [selectid.selectedindex] .text);
//これを通して価値とテキストを取得することもできます
アラート(this.value);
Alert(this.options [this.selectedIndex] .text);
};
</script>