<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
 <TITLE> New Document </TITLE>

 <script language="JavaScript" type="text/javascript">
   //定义了巡课人的二维数组,里面的顺序跟年级的顺序是相同的。通过selectedIndex获得年级的下标值来得到相应的巡课人数组
   var city=[
   ["德强","超","传武","建忠","畅"],
    ["硕","斌","传武","建忠","畅"],
   ["江峰","超","传武","建忠","畅"],
    ["刚","超","传武","建忠","畅"],
    ["培铃","超","传武","建忠","畅"],
   ];
 
   function getCity(){
     //获得省份下拉框的对象
     var sltProvince=document.form1.province;
     //获得城市下拉框的对象
     var sltCity=document.form1.city;     
     //得到对应省份的城市数组
     var provinceCity=city[sltProvince.selectedIndex - 1];
 
     //清空城市下拉框,仅留提示选项
     sltCity.length=1;
 
     //将城市数组中的值填充到城市下拉框中
     for(var i=0;i<provinceCity.length;i++){
       sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]);
     }
   }
 </script>
 </HEAD>
 
 <BODY>
 <FORM METHOD=POST ACTION="" name="form1">
     <SELECT NAME="province" onChange="getCity()">
       <OPTION VALUE="0">选择年级 </OPTION>
       <OPTION VALUE="九年级">九年级 </OPTION>
       <OPTION VALUE="八年级">八年级 </OPTION>
       <OPTION VALUE="七年级">七年级 </OPTION>
       <OPTION VALUE="六年级">六年级 </OPTION>
       <OPTION VALUE="五年级">五年级 </OPTION>
     </SELECT>
     <SELECT NAME="city">
       <OPTION VALUE="0">选择巡课人 </OPTION>
     </SELECT>
   </FORM>
 </BODY>
</HTML>