如何让下拉框同时具有录入功能

fxxl 2003-08-18 11:45:47
在录入表单中,有些字段的内容即要求提供下拉框选择,又要求可以录入,如何实现呢?
...全文
51 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fxxl 2003-08-20
  • 打赏
  • 举报
回复
好象不行呀!
sunicom 2003-08-19
  • 打赏
  • 举报
回复
去看看:http://www.csdn.net/develop/Read_Article.asp?Id=15074
随风奔跑 2003-08-19
  • 打赏
  • 举报
回复
找找梅花雨大侠的,他写过一个很好的.
好像孟子也写过.
这里得不少文章涉及到这个,可以搜索一下,找到不少.
ydr2002 2003-08-19
  • 打赏
  • 举报
回复
HTML里没有这样的控件,可以用组合控件来模拟这样的功能
coffee_cn 2003-08-19
  • 打赏
  • 举报
回复
别人的例子
<body onload="s1.focus();">
<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>
<select name=s1 onkeydown="catch_keydown(this);" onkeypress="catch_press(this);" style="font-size:12px;"><option>---</option></select>
<BR>按回車輸入新內容,按DEL刪除選中內容
</body>

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧