<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title>
<style>
.afterPreviousFont
{
position:absolute;
width:20;
overflow:hidden;
direction:rtl;
left:expression(this.previousSibling.offsetLeft+this.previousSibling.offsetWidth-1);
}
</style></head><body>可输入下拉框,用来凑热闹,没什么实际用途<br>
请输入:<input style="width:100" onchange="this.nextSibling.all[0].value=this.value;"><font class="afterPreviousFont" >
<select style="width:120" dir=ltr onchange="this.parentElement.previousSibling.value=this.value;"><option value="">
  <option value="abcde">abcde</option>
  <option value="this is jk glad to meet you">this is jk glad to meet you</option>
</select>
</font>
</body></html>

解决方案 »

  1.   

    <select name="ss">
    <option value="11">aaa</option>
    <option value="22">bbb</option>
    </select>
    是不是这个啊,说的不是很明白
      

  2.   

    http://www.51js.com/viewthread.php?fpage=1&tid=4753
      

  3.   

    這樣就行了:<input type=text name=re_name style="width:100px;height:22px;font-size:10pt;"><span style="width:18px;"><select name="r00" style="margin-left:-100px;width:118px; background-color:#FFEEEE;" onChange="document.all.re_name.value=this.value;">
                    <option value="1">11111111<option>
                    <option value="2">222222</option>
                    <option value="3">333333</option>
                  </select>
                  </span>
      

  4.   

    回复人: BILLSJONE(BILL_JONE) ( ) 信誉:93  2004-11-09 16:31:00  得分: 0  -------------
    挺好
      

  5.   

    比如:页面上的下拉框内容已经生成好了,我想在页面上编辑下拉框,不是在script里编辑:p
      

  6.   

    你是不是想增删改指定的selection内容啊?<html>
    <head>
    <title>可以编辑的下拉列表 - by WildWind<[email protected]>...</title>
    <script language="JavaScript">
    <!--
    function catch_keydown(sel)
    {
        switch(event.keyCode)
        {
            case 13:
                //Enter;
                sel.options[sel.length] = new Option("","",false,true);
                event.returnValue = false;
                break;
            case 27:
                //Esc;
                alert("text:" + sel.options[sel.selectedIndex].text + ", value:" + sel.options[sel.selectedIndex].value + ";");
                event.returnValue = false;
                break;
            case 46:
                //Delete;
                if(confirm("删除当前选项!?"))
                {
                    sel.options[sel.selectedIndex] = null;
                    if(sel.length>0)
                    {
                        sel.options[0].selected = true;
                    }
                }
                event.returnValue = false;
                break;
            case 8:
                //Back Space;
                var s = sel.options[sel.selectedIndex].text;
                sel.options[sel.selectedIndex].text = s.substr(0,s.length-1);
                event.returnValue = false;
                break;
        }
        
    }
    function catch_press(sel)
    {
        sel.options[sel.selectedIndex].text = sel.options[sel.selectedIndex].text + String.fromCharCode(event.keyCode);
        event.returnValue = false;
    }
    //-->
    </script>
    </head><body onload="s1.focus();">
    <h3>操作方法:</h3>
    <p>
    1.按Enter键开始添加输入新的选项...<br>
    2.按Del键删除当前选项...<br>
    3.按Esc键查看当前选项的text和value值...<br>
    4.按BackSpace键删除当前选项的前一个字符...<br>
    </p>
    <h3>测试结果:</h3>
    <p>
    1.IE6.0测试通过...<br>
    </p>
    <br>
    <h3>建议&意见:</h3>
    <p>
    1.大家可以做成htc,将这些函数绑在css上(很简单,不再介绍...)...<br>
    </p>
    <h3>示例:</h3>
    <p>
    <select name=s1 onkeydown="catch_keydown(this);" onkeypress="catch_press(this);" style="font-size:12px;"><option>---</option></select>
    </p>
    </body>
    </html>