Put this js code in the HTML of your page.
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 46: // Delete;
If (confirm ("exclude content before expiration !? ")){
Sel. Options [SEL. selectedindex] = NULL;
If (SEL. length> 0) {SEL. Options [0]. Selected = true ;}}
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); event. returnvalue = false;
}
Drag a dropdownlist control in your program and find the code of this control on the HTML page.
Add onkeydown = "catch_keydown (this);" onkeypress = "catch_press (this );"
Just run the program.