ASP.NET: DROPDOWNLIST input and pick 316

xiaoxiao2021-03-17  186

DropDownList controls are often used in ASP.NET, such as customer code, customer name, or accounting subject, account name, and when the user's data is more, it is not possible to enter it directly, and the pen point is selected to User In order to make a headache, as follows:

Value Text

111101 cash - RMB

111102 cash - hkd

...

6141001 Sales fee - salary expenditure

6141002 Sales fee - travel expenses

6141003 Sales Fee - Postage

...

6241001 Administration fee - salary expenditure

6241002 Management costs - travel expenses

6241003 Management Fees - Postage

...

User hopes to run to 6141001 and select it directly when you enter 6141001.

After this problem, I have been troubled for a long time, with the help of a netizen, today I finally found a satisfactory solution ^ __ ^, the method is as follows: (enter value, show related text)

Function catch_keydown (sel) {switch (event.keycode) {case 13: // enter; //sel.Options[SEL.LENGTH] = New option (",", ",", ","; = false; // Break; case 27: // esc; // alert ("text:" sel.Options [sel.selectedindex] .text ", value:" sel.Options [sel.selected ". Value ";"); //Event.ReturnValue = false; break; case 46: // delete; //iff (confirm ("Delete Current content !?") {//sel.Options[sel.selectedIndIndex] = Null; //if (sel.length) {SEL.OPTIONS [0] .selected = true;}} //Event.returnValue = false; Break; Case 8: // back space; // var s = SEL .Options [sel.selected ".Text; var s = sel.Options [0] .text; sel.options [0] .text = s.substr (0, s.Length-1); Event.ReturnValue = false; Break;}} // only displayed on the first option

function catch_press (sel) {if (sel.selectedIndex == 0) {sel.options [sel.selectedIndex] .text = sel.options [sel.selectedIndex] .text String.fromCharCode (event.keyCode); event.returnValue = false;}} // Enter the value on the first option

Function CA () {var select_obj = document.getlementByid ("DropdownList1"); var aa = select_obj.Options [0] .text; var QQ = aa.length; if (select_obj.Options.Length) {for (var i = 0; i 002 aaaa AAAB < ASP: ListItem value = "6141003"> AAAC AAAAD AAAE aaag

In addition, JS readings for another event is called in an event such as onblur () = "CA (); this.onchange ();"

转载请注明原文地址:https://www.9cbs.com/read-129491.html

New Post(0)