ทำ Auto Complete ให้ Textbox แบบกำหนดคำค้นหาเอง


Begin entering text into the above textbox to see the control in action

Code for the text control in this example:

<input type="text" id="my_textctrl" onkeyup='acAutoComplete("my_textctrl", event, my_word_list);' onblur='acDelayHide();'>

The following is added in the <head> of the HTML document to allow this control to be created:

<script language="Javascript" type="text/Javascript" src="jscautocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="autocomplete.css">

The following is also added in the <head> of the HTML document to provide a list of words for this autocomplete control:

<script language="Javascript" type="text/Javascript">
<!--
my_word_list = new Array("The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog", "and", "this", "software", "auto complete", "control", "is", "from", "AdvanceByDesign");
// -->
</script>