欢迎光临
我们一直在努力

经常看见有人问能不能实现这个效果:下拉选框中输入文字。想实现的进来看看

建站超值云服务器,限时71元/月

<script>

function pp(){

se.options[2]=new option(ok=(se.options[2])?se.options[2].innertext+string.fromcharcode(event.keycode):string.fromcharcode(event.keycode),"client")
se.selectedindex=2;
}

function edit(){
if(se.options[2]){
if(event.keycode==8){
var str=se.options[2].innertext;
var len=str.length;
se.options[2].innertext=str.substring(0,len-1);
if(se.options[2].innertext=="")se.remove(2);
}
if(event.keycode==13)return false;
if(event.keycode==32){
se.options[2].innertext+=" ";

}
}
}
</script>
<select id=se onkeypress=pp() onkeyup="edit()">
<option>测试程序
<option>tullia
</select>

运行的时候看上去似乎是不可以输入的,但是其实是可以的,直接输入试试看:)

转自51js

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 经常看见有人问能不能实现这个效果:下拉选框中输入文字。想实现的进来看看
分享到: 更多 (0)

相关推荐

  • 暂无文章