<form name="doublecombo" action="#" method=post>
  <table border="0" cellPadding="0" cellSpacing="0" width="601" height="19">
    <tr> 
      <td height="14" width="601" colspan="2"> <p align="center"><font color="midnightblue">基本项目查询统计 
          </font></p></td>
    </tr>
    <Tr> 
      <td height="14" width="601"> &nbsp; <select name="example" size=1 onChange="redirect(this.options.selectedIndex)">
          <option value="0">000</option>
          <option value="1">111</option>
          <option value="2">222</option>
          <option value="3">333</option>
        </select> &nbsp; <select name="stage2" size=1>
          <option value="0">项目属性</option> &nbsp; 
        <input type="text" name="stage3" size="12">
        <script>
<!--
  var groups=document.doublecombo.example.options.length
  var group=new Array(groups)
  for (i=0; i<groups; i++)
  group[i]=new Array()
  group[0][0]=new Option("000")  group[1][0]=new Option("10","")  group[2][0]=new Option("20","")  group[3][0]=new Option("30","")var temp=document.doublecombo.stage2
function redirect(x){
  for (m=temp.options.length-1;m>0;m--)
  temp.options[m]=null
  for (i=0;i<group[x].length;i++){
  temp.options[i]=new Option(group[x][i].text,group[x][i].value)
  }
  temp.options[0].selected=true
  //以下是增加的代码
  doublecombo.stage3.value=doublecombo.example.options[doublecombo.example.selectedIndex].text;
  }
function go(){
  location=temp.options[temp.selectedIndex].value
  }
  -->
  </script> </td>
      <td height="14" width="340"> </td>
    </tr>
  </table>
</form>

解决方案 »

  1.   

    TO: freefalcon(心宇)   谢谢但是我的文本框里要的是 000,10,20,30 数组里的值; 另外多行如何取得里面的值?<html>
    <head>
    <title>无标题文档</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body bgcolor="#FFFFFF" text="#000000">
    <form name="doublecombo" action="#" method=post>
      <table border="0" cellPadding="0" cellSpacing="0" width="601" height="19">
        <Tr> 
          <td height="14" width="601"> &nbsp; <select name="example" size=1 
    onChange="redirect(this.options.selectedIndex)">
              <option value="0">000</option>
              <option value="1">111</option>
              <option value="2">222</option>
              <option value="3">333</option>
            </select> &nbsp; 
            <input type="text" name="stage3" size="12">
    <br>
     &nbsp; <select name="example" size=1 
    onChange="redirect(this.options.selectedIndex)">
              <option value="0">000</option>
              <option value="1">111</option>
              <option value="2">222</option>
              <option value="3">333</option>
            </select> &nbsp; 
            <input type="text" name="stage3" size="12">
            <script>
    <!--
      var groups=document.doublecombo.example.options.length
      var group=new Array(groups)
      for (i=0; i<groups; i++)
      group[i]=new Array()
      group[0]=new Option("000")
      group[1]=new Option("10","")
      group[2]=new Option("20","")
      group[3]=new Option("30","")var temp=document.doublecombo.stage3
    function redirect(x){
      temp.value=doublecombo.example.options[doublecombo.example.selectedIndex].text;
      }
    -->
      </script> </td>
          <td height="14" width="340"> </td>
        </tr>
      </table>
    </form>
    </body>
    </html>
      

  2.   

    <html>
    <head>
    <title>无标题文档</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body bgcolor="#FFFFFF" text="#000000">
    <form name="doublecombo" action="#" method=post>
      <table border="0" cellPadding="0" cellSpacing="0" width="601" height="19">
        <Tr> 
          <td height="14" width="601"> &nbsp; <select name="example1" size=1             
    onChange="redirect(this.options.selectedIndex)">
              <option value="0">000</option>
              <option value="1">111</option>
              <option value="2">222</option>
              <option value="3">333</option>
            </select> &nbsp;             
            <input type="text" name="stage3" size="12">
    </td></tr><tr><td>
     &nbsp; <select name="example1" size=1             
    onChange="redirect(this.options.selectedIndex)">
              <option value="0">000</option>
              <option value="1">111</option>
              <option value="2">222</option>
              <option value="3">333</option>
            </select> &nbsp;             
            <input type="text" name="stage3" size="12">
            <script>            
    <!--
      
    function redirect(x){
      var txtobj = window.event.srcElement.parentElement.children[1];  txtobj.value=window.event.srcElement.options[x].value;
      }
    -->
      </script> </td>
          <td height="14" width="340"> </td>
        </tr>
      </table>
    </form>
    </body>
    </html>
      

  3.   

    TO:sun1979song(十步杀一人)  谢谢
    不好意思,是我没说明白,我想作的是,在下拉菜单选择后,文本框显示相应传入的数组里的值
    <form name="doublecombo" action="#" method=post>
      <table border="0" cellPadding="0" cellSpacing="0" width="601" height="19">
        <tr> 
          <td height="14" width="601" colspan="2"> <p align="center"><font color="midnightblue">
              </font></p></td>
        </tr>
        <Tr> 
          <td height="14" width="601"> &nbsp; <select name="example" size=1 onChange="redirect(this.options.selectedIndex)">
              <option value="0">000</option>
              <option value="1">111</option>
              <option value="2">222</option>
              <option value="3">333</option>
            </select> &nbsp; <select name="stage2" size=1>
              <option value="0">000</option>
            <script>
    <!--
      var groups=document.doublecombo.example.options.length
      var group=new Array(groups)
      for (i=0; i<groups; i++)
      group[i]=new Array()
      group[0][0]=new Option("000")
      group[1][0]=new Option("10","")
      group[2][0]=new Option("20","")
      group[3][0]=new Option("30","")var temp=document.doublecombo.stage2
    var temp2=document.doublecombo.stage3
    function redirect(x){
      for (m=temp.options.length-1;m>0;m--)
      temp.options[m]=null
      for (i=0;i<group[x].length;i++){
      temp.options[i]=new Option(group[x][i].text,group[x][i].value)
      }
      temp.options[0].selected=true
      }
    function go(){
      location=temp.options[temp.selectedIndex].value
      }
      -->
      </script> </td>
          <td height="14" width="340"> </td>
        </tr>
      </table>
    </form>
      

  4.   

    <form name="doublecombo" action="#" method=post>
      <table border="0" cellPadding="0" cellSpacing="0" width="601" height="19">
        <tr> 
          <td height="14" width="601" colspan="2"> <p align="center"><font color="midnightblue">
              </font></p></td>
        </tr>
        <Tr> 
          <td height="14" width="601"> &nbsp; <select name="example" size=1 onChange="redirect(this.options.selectedIndex)">
              <option value="0">000</option>
              <option value="1">111</option>
              <option value="2">222</option>
              <option value="3">333</option>
            </select> &nbsp; <select name="stage2" size=1>
              <option value="0">000</option>
            <input type="text" name="stage3" size="12">
            <script>
    <!--
      var groups=document.doublecombo.example.options.length
      var group=new Array(groups)
      for (i=0; i<groups; i++)
      group[i]=new Array()
      group[0][0]=new Option("000")
      group[1][0]=new Option("10","")
      group[2][0]=new Option("20","")
      group[3][0]=new Option("30","")var temp=document.doublecombo.stage2
    var temp2=document.doublecombo.stage3
    function redirect(x){
      for (m=temp.options.length-1;m>0;m--)
      temp.options[m]=null
      for (i=0;i<group[x].length;i++){
      temp.options[i]=new Option(group[x][i].text,group[x][i].value)
      }
      temp.options[0].selected=truedocument.all.stage3.value=group[x][0].text;  }
    function go(){
      location=temp.options[temp.selectedIndex].value
      }
      -->
      </script> </td>
          <td height="14" width="340"> </td>
        </tr>
      </table>
    </form>