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>

  • 相关阅读:
    京东饭粒捡漏V1.15
    京东饭粒捡漏V1.14
    京东饭粒捡漏V1.13
    京东饭粒捡漏V1.1.0
    京东饭粒捡漏V1.0.8
    京东饭粒捡漏V1.0.7
    性能瓶颈分析总结
    Jmeter循环控制
    HttpClient接口测试之会话保持
    Jenkins自动部署Tomcat项目
  • 原文地址:https://www.cnblogs.com/WangJinYang/p/2787607.html
Copyright © 2011-2022 走看看