簡単なjsコードはselece二級連動を実現する(推奨)


以下はhtmlコードです。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
<!-- by sundful  starting-->
 <BODY>
  <script   language="JavaScript">    

  var   subcat   =   new   Array();    
  subcat[0]   =   new   Array(' ',' ',' ')    
  subcat[1]   =   new   Array(' ',' ',' ')       
  subcat[2]   =   new   Array(' ',' ',' ')    
  subcat[3]   =   new   Array(' ',' ',' ')        
  function   changeselect1(locationid)    
  {    
  document.form1.s2.length   =   0;   //        
  document.form1.s2.options[0]   =   new   Option('== ==','');   //     
  for   (i=0;   i<subcat.length;   i++)   //legth=20    
  {    
  if   (subcat[i][0]   ==   locationid)   //[0]   [1]          
  {document.form1.s2.options[document.form1.s2.length]   =   new   Option(subcat[i][1],   subcat[i][2]);}   // option    
  //    length=1   == ==    
  //i=9    length=   10   11    0    subcat[i][0]   ==   locationid     
  }    
  }    
  </script>    

  <form   name="form1"     method="post"   runat="server">    
  :    

  <select   name="s1"   onChange="changeselect1(this.value)">    
  <option>== ==</option>    
  <option   value=" "> </option>    
  <option   value=" "> </option>
  <option   value=" "> </option>
  </select>      

  <select   name="s2">    
  <option>== ==</option>    
  </select>    
  </form>
<!-- by sundful  ending--> 
 </BODY>
</HTML>