如何實(shí)現(xiàn)在下拉菜單里輸入文字?
如何實(shí)現(xiàn)在下拉菜單里輸入文字?
<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>山水盈盈之輸入文字
</select>
相關(guān)文章
如何編寫高質(zhì)量的前端代碼(快手電商前端前端代碼規(guī)范)
這篇文章主要介紹了如何編寫高質(zhì)量的前端代碼,這篇規(guī)范寫的不錯(cuò)!需要的朋友可以參考下2024-02-02如何用組件實(shí)現(xiàn)自動(dòng)發(fā)送電子郵件?
如何用組件實(shí)現(xiàn)自動(dòng)發(fā)送電子郵件?...2006-11-11如何正確顯示數(shù)據(jù)庫里同時(shí)存在的GB碼和BIG5碼?
如何正確顯示數(shù)據(jù)庫里同時(shí)存在的GB碼和BIG5碼?...2006-11-11CPU,GPU,DPU,TPU,NPU,BPU等處理器的性能及概念
CPU,GPU,DPU,TPU,NPU,BPU各種U還在傻傻分不清么?本文帶你領(lǐng)略這些不同的U所代表的意義,讓你有醍醐灌頂般的醒悟收獲,有需要的朋友可以借鑒參考2021-08-08