<html>
<head></head>
<body>
<script language="javascript">
 function Show()
 {
  temp=document.form1.a[document.form1.a.options.selectedIndex].value;
  if (temp=="a")
  { i=1;}
  if (temp=="b")
  {i=4;}
  if (temp=="c")
  {i=7;}
   for(j=i,p=0;j<i+3;j++,p++)
  document.form1.b.options[p]=new Option(j); 
 }
</script>
<form name="form1" method="POST">
<p>
<select size="1" name="a" onchange="Show();">
<option></option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option>
</select>
<select size="1" name="b">
</select>
</form>
</body>
</html>

解决方案 »

  1.   

    http://www.csdn.net/Expert/topic/505/505836.shtm
      

  2.   

    to:netgirl((网络女孩))
    哇塞,简直为我的要求而做的代码................(不太严谨哦)
    没有什么可扩充性,而且在netscape4.79下测试不通过.但毕竟是完成了我的要求的.150分自然是你的了.把你的代码修改如下就可以运行在netscape4.79下了.
    <html>
    <head></head>
    <body>
    <script language="javascript">
    function Show()
    {
      temp=document.form1.a[document.form1.a.options.selectedIndex].value;
      if (temp=="a")
      { i=1;}
      if (temp=="b")
      {i=4;}
      if (temp=="c")
      {i=7;}
      for(j=i,p=0;j<i+3;j++,p++)
      document.form1.b.options[p]=new Option(j); 
    }
    </script>
    <form name="form1" method="POST">
    <p>
    <select size="1" name="a" onchange="Show();">
    <option></option>
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>
    <option>
    </select>
    <select size="1" name="b">
    <option value=1>
    <option value=2>
    <option value=3>
    <option value=4>
    </select>
    </form>
    </body>
    </html> 
    明天我来结帐.......
      

  3.   

    可以试一下下面这个。
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb_2312-80">
    <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
    <title>销售数量分布汇总表</title>
    <script language="javascript">
    <!--
    var array_a=new Array("1","2","3");
    var array_b=new Array("4","5","6");
    var array_c=new Array("7","8","9");
    //定义对应的数组,如果是动态生成的数据,可以从数据库取到本地数组中function change_show()
    {
      var tmp=window.document.QueryForm.sel1.value;//select1中的值
      if (tmp=="a")     the_array=eval(array_a);
      if (tmp=="b")     the_array=eval(array_b);
      if (tmp=="c")     the_array=eval(array_c);
      //判断要显示哪一个数组的数据  var arr_len=window.document.QueryForm.sel2.options.length
      for (loop=0;loop<arr_len;loop++)
      {
        window.document.QueryForm.sel2.remove(0);
    //先清空第二个select中的所有数据
      }
      
      for (loop=0;loop<the_array.length;loop++)
      {
    var e=window.document.createElement ("OPTION");//创建新对象
       e.text=the_array[loop];
    e.value=the_array[loop];//赋值
    window.document.QueryForm.sel2.add(e);  //添加到select2中
      }
       window.document.QueryForm.sel2.refresh;//刷新第二个select
    }
    -->
    </script>
    <body>
    <form name=QueryForm>
    <select name=sel1 size=1 onclick="javascript:change_show()">
    <option selected value=a>a</option>
    <option value=b>b</option>
    <option value=c>c</option>
    </select><select name=sel2 size=1></select>
    </form>
    </body>
    </html>
      

  4.   

    <html>
    <head></head>
    <body>
    <script language="javascript">
    function Show()
    {
      temp=document.form1.a[document.form1.a.options.selectedIndex].value;
      if (temp=="a")
      { i=1;}
      if (temp=="b")
      {i=4;}
      if (temp=="c")
      {i=7;}
      for(j=i,p=0;j<i+3;j++,p++)
      document.form1.b.options[p]=new Option(j); 
    }
    </script>
    <form name="form1" method="POST">
    <p>
    <select size="1" name="a" onchange="Show();">
    <option></option>
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>
    <option>
    </select>
    <select size="1" name="b">
    <!--modified
            <option value=1>
            <option value=2>
            <option value=3>
            <option value=4>
    -->
    </select>
    </form>
    </body>
    </html> 
      

  5.   

    option value也可以在javascript中动态设定的,象你这样不好,要是有1000个,怎么办