有些信息在select里没有,想在select里直接输入,能不能模仿出这样一个组件出来达到这个目的?

解决方案 »

  1.   

    <style>
    .sel_size{
    FONT-SIZE : 14px;
    FONT-STYLE : normal;
    FONT-VARIANT : normal;
    FONT-WEIGHT : normal;
    LINE-HEIGHT : normal; 
    background-color : #fefefe;
    }
    input.smallInput {
        border : 1 solid;
    FONT-SIZE : 14px;
    FONT-STYLE : normal;
    FONT-VARIANT : normal;
    FONT-WEIGHT : normal;
    HEIGHT : 20px;
    LINE-HEIGHT : normal; 
    background-color : #fefefe;
    }
    </style>
    <select name="a" class="sel_size" onchange="setName()"  style=" position:absolute;width:101px;height:20px;clip:rect(0,100,20,80)" > 
                      <option value=""></option>
                      <option value="北京">北京</option>
                      <option value="天津">天津</option>
    </select>
    <input type="text" name="b" class="smallInput"  style="position:relative;top:0px; width: 100px; height: 20px" >
    <script>
    function setName(){
    document.all.b.value=document.all.a.value;
    alert(document.all.b.value);
    }
    </script>
    </script>
      

  2.   

    javapigpig(javapig) :我用你的方法怎么不行,还是只可以选择,不可以输入,你自己测试了吗,不行。
      

  3.   

    <input type="text" name="test">
    <select name="newtest">
    <option value="1">测试1</option>
    </select>在被提交页的地方加判断,
    String testvalue="";
    if(request.getParameter("test")!=null&&!request.getParameter("test").equals("")){
    testvalue=request.getParameter("test");
    }else if(request.getParameter("test")!=null&&!request.getParameter("test").equals("")){
    testvalue=request.getParameter("newtest");
    }
      

  4.   

    刚才写错了!
    <input type="text" name="test">
    <select name="newtest">
    <option value="1">测试1</option>
    </select>在被提交页的地方加判断,
    String testvalue="";
    if(request.getParameter("test")!=null&&!request.getParameter("test").equals("")){
    testvalue=request.getParameter("test");
    }else if(request.getParameter("newtest")!=null&&!request.getParameter("newtest").equals("")){
    testvalue=request.getParameter("newtest");
    }