The reference code comes from here:
Http://www.jb51.net/article/28075.htm
But to tell the truth, this site is too rotten, not suitable to look at the code, another code is a Daniel, but there is no modular thinking, so I am not happy to use directly, simply is the weekend to spend time to write a bar.
Clarify the requirements:
An input box is required, after the user input (KeyUp event), the user input is returned to the outside, and the external information is obtained from the input box, displayed
Other than that:
1, in the loss of focus, need to eliminate the prompt box
2, need to block the browser's original prompt function
3, listen to the keyboard up and down, loop Select Prompt item
4. Reposition the Cue box when the window position changes
Module structure:
function Autocompleteinput (input,callback) { this. input = input; this. callBack = callBack;} /* */function(TXT) {};
Simple enough, huh? Ha, the following is realized, please look forward to it, it is estimated that the evening can be finished.
JS class Baidu dynamic Cue box thinking and completion