The overall idea is this: 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 which event in the text box can meet the requirements. The first thing that came to mind was onkeydown or onkeypress. During the trial, I found that when I entered Chinese again, I could not respond because the input party would block the focus. After searching online for a while, I found that the onpropertychange event will start when changing the text properties, so when entering data in the text box, it is actually changing the value property of the text box. And Chinese can also satisfy it. I thought the work was done, but in the end I found out that this event was exclusive to IE, and other browsers did not have this event. The corresponding oninput can meet the needs.
The specific implementation is to text box and hide button. When entering content in the text box, call onpropertychange or oninput event, find the hidden button in this event, and then set off 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 previous event of the hidden button is done in Javascript. It should be noted that it is to obtain the ClientID of the server control in the foreground). The script code is as follows:
<script type="javascript/text" language="javascript">
function btnClick()
{
var btnID = "<%=%>";
var btnObject = (btnID);
if(btnObject)
{
();
}
}
</script>
According to this idea, the first thing to solve is to determine which event in the text box can meet the requirements. The first thing that came to mind was onkeydown or onkeypress. During the trial, I found that when I entered Chinese again, I could not respond because the input party would block the focus. After searching online for a while, I found that the onpropertychange event will start when changing the text properties, so when entering data in the text box, it is actually changing the value property of the text box. And Chinese can also satisfy it. I thought the work was done, but in the end I found out that this event was exclusive to IE, and other browsers did not have this event. The corresponding oninput can meet the needs.
The specific implementation is to text box and hide button. When entering content in the text box, call onpropertychange or oninput event, find the hidden button in this event, and then set off 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 previous event of the hidden button is done in Javascript. It should be noted that it is to obtain the ClientID of the server control in the foreground). The script code is as follows:
Copy the codeThe code is as follows:
<script type="javascript/text" language="javascript">
function btnClick()
{
var btnID = "<%=%>";
var btnObject = (btnID);
if(btnObject)
{
();
}
}
</script>