Copie el código de código de la siguiente manera:
<guión>
función clearOption(obj,e){
var currKey=0,e=e||evento;
currKey=e.keyCode||e.cual||e.charCode;
si(clavecurr == 8){
obj.opciones[0].texto = "";
}
}
función escribirSelect(obj,e){
var currKey=0,e=e||evento;
currKey=e.keyCode||e.cual||e.charCode;
obj.options[0].selected = "seleccionar";
if(currKey! = 8){// Este lugar es para evitar molestos caracteres confusos en Firefox. Puedes intentar comentar esta oración para ver el efecto en Firefox.
obj.options[0].text = obj.options[0].text + String.fromCharCode(currKey);
}
e.returnValue=false;
devolver obj.opciones[0].texto;
}
funciónttt(){
var jg = document.getElementById("aa").options[document.getElementById("aa").selectedIndex].text;
// Por supuesto, también puedes establecer el valor de las opciones en la función writeSelect anterior al mismo tiempo. En este caso, puedes usar el valor directamente para eliminarlo en el programa.
jQuery("#aa").empty();
jQuery("#aa").append("<valor de opción=''></option>");
}
</script>
Copie el código de código de la siguiente manera:
<select style='width:150px;z-index:-1' id="aa" name="selectHelpCode" onkeydown="clearOption(this,event)" onkeypress="writeSelect(this,event)">
<opción valor=""></opción>
<opción valor="11">11</option>
<opción valor="22">22</option>
<opción valor="33">33</option>
</seleccionar>
<tipo de entrada="botón" valor="Borrar" onclick="ttt();"/>