怎样实现二级联动菜单即可选择又可输入???

来源:互联网 发布:淘宝差评会怎么样 编辑:程序博客网 时间:2024/05/01 02:10
各位大哥,请教一下怎样可以实现二级联动菜单即可选择又可输入??
比如我选择字母时二级菜单可选择A,B.....

如果我选择”其他“时二级菜单怎样可以直接输入??

代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Test</title>

<script language="javascript">
function changedevice(){
  var devices=new Array();
  devices['字母']=['A','B','C','D','E','F'];
  devices['数字']=['1','2','3','4','5','6'];
  devices['其他']=[''];
  var pIndex=document.Changer.QueryMode.value;
  var newpotion3;
     document.Changer.PartsChanger.options.length=0;
     for(var j in devices[pIndex]){
      newpotion3=new Option(devices[pIndex][j],devices[pIndex][j]);
      document.Changer.PartsChanger.options.add(newpotion3);
  }
  }
</script>

</head>

<body>
<div class="n0" style="margin-left:250px;width:800px;height:auto;">
 <form name="Changer" action="" method="post">
    
    <table border="0" align="center" cellpadding="2" cellspacing="4">
    <tr>
    <td style="size:12px;">请选择查询方式:</td>
        <td><select name="QueryMode" size="1" style="width:180;" onChange="changedevice()">
        <option>--请选择--</option>
<option value="字母">字母</option>
    <option value="数字">数字</option>
            <option value="其他">其他</option>
    </select></td>
    </tr>
<tr>   
<td style="size:12px;">请输入:</td>
    <td>
        <select name="PartsChanger" id="PartsChanger" size="1" style="width:180;" ></select>               
        </td>
    <td><input type="submit" value="查询" /></td>
    </tr>
    </table>
</form>
</div>
</body>
</html>

0 0
原创粉丝点击