-- doesn't trample the "window" object's namespac
-- doesn't trample your existing event handlers, and adding your own doesn't break things
-- easily reusable by others for other purposes
Here's the InputComplete (and InputCompleteData) class file, object oriented and MVC:
View the source for how to use it:
Create a data model (the word list to autocomplete), and create autocomplete objects for each input element, using that model.