The overall idea is that when the value of the text box changes, the event is triggered to filter the original values in the list.
According to this idea, the first thing to solve is to determine what event in the text box can meet the requirements. At that time, the first thing to think of was onkeydown or onkeypress. During the trial, when I found that I entered Chinese characters again, unable to respond, because the input party will block the focus. After searching on the Internet for a while, I found that the onpropertychange event will start when changing the text attribute. Therefore, when inputting data in the text box, it is actually changing the value attribute of the text box. In addition, Chinese characters can be satisfied. I thought it was a success, and finally I found this event as an exclusive event of IE. other browsers did not. The corresponding oninput can meet the requirements.
The specific implementation is the text box and hidden button. When the content is entered in the text box, the onpropertychange or oninput event is called. Find the hidden button in the event and start its click event, in this way, we only need to filter the list data in the Click Event of the hidden button in the background (of course, the events of the hidden button in front are implemented using JavaScript, it should be noted that the client ID of the server control is obtained at the front-end.CodeAs follows:
Copy codeThe Code is as follows: <SCRIPT type = "javascript/text" Language = "JavaScript">
Function btnclick ()
{
VaR btnid = "<% = This. btnsearch. clientid %> ";
VaR btnobject = Document. getelementid (btnid );
If (btnobject)
{
Btnobject. Click ();
}
}
</SCRIPT>