title: some code's meaning of javascript?
body: <pre><code> &lt;script language="JavaScript" type="text/javascript"&gt;     
       var city=[
       ["city1","city2","city3","city4"],
      ["city5","city6","city7"],
       ["city8","city9","city10"],
       ];
  
       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&lt;provinceCity.length;i++){
               sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]);
           }
       }
  &lt;/script&gt;
   &lt;FORM METHOD=POST ACTION="" name="form1"&gt;
           &lt;SELECT NAME="province" onChange="getCity()"&gt;
               &lt;OPTION VALUE="0"&gt;select province &lt;/OPTION&gt;
               &lt;OPTION VALUE="province1"&gt;province 1 &lt;/OPTION&gt;
               &lt;OPTION VALUE="province2"&gt;province2&lt;/OPTION&gt;
               &lt;OPTION VALUE="province3"&gt;province3 &lt;/OPTION&gt;
           &lt;/SELECT&gt;
           &lt;SELECT NAME="city"&gt;
              &lt;OPTION VALUE="0"&gt;select the city&lt;/OPTION&gt;
          &lt;/SELECT&gt;
       &lt;/FORM&gt;
  </code></pre>
  
  <p>the above code is according to the province select its city. there are some lines i don't understand well. expect some one can explain it. thank you.</p>
  
  <p>1, what's these lines do and meaning? </p>
  
  <pre><code>var provinceCity=city[sltProvince.selectedIndex - 1];
  </code></pre>
  
  <p>and</p>
  
  <pre><code>  sltCity.length=1;  
    sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]);
  </code></pre>