zoukankan      html  css  js  c++  java
  • js 实现 combox

     

    <SCRIPT LANGUAGE="JavaScript"> <!-- Begin 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 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); sel.options[sel.selectedIndex].value = sel.options[sel.selectedIndex].value + String.fromCharCode(event.keyCode);

    event.returnValue = false; } //End --> </script>

    </head> <center> <select name="fh_cp" onKeyDown="catch_keydown(this);" onKeyPress="catch_press(this);" style="200px;"> <option></option> <option value="1">倒萨快递费</option> <option value="2">速度空间开始打飞机</option> </select> </center> </body> </html>

  • 相关阅读:
    document基本操作 动态脚本-动态样式-创建表格
    js原型模式和继承
    NuGet本地包自定义路径
    技术文档链接收藏
    数据结构排序
    Insertion Sort
    选择排序之javascript
    冒泡排序之javascript
    C++双向链表
    单向链表
  • 原文地址:https://www.cnblogs.com/WangJinYang/p/2787607.html
Copyright © 2011-2022 走看看