Jump to content
Larry Ullman's Book Forums

Recommended Posts

I am developing a Spanish language learning app and having trouble with the text input in the upper right corner.




Previously the app was done in Flex, and it has tying functionality which is more enjoyable to use than the current javascript version (above link).




Notice if user types a word in FlexApp box, for example,  print


in dictionarry, the drop down display box continues to display other words that do not match this string.  The typing function always forwards to a word on a list, and displays adjacent words in the dropdown.


QUESTION:  I have the source code for the Flex App.  Can I copy the typing functionality into the Javascript app?  OR, is there another way to achieve a similar result.



All advice is greatly appreciated.

Brian Matthews

Link to comment
Share on other sites

While it makes me cringe a little, probably your best bet is to make an unordered list with all of the words, and then jump to the appropriate word when you start typing.


You'll want to hook up an onkeydown event handler to the text input, and then every time an event fires, compare the string in the text input to all the words in the list. As soon as you find a word that matches, you can jump to it by figuring out how far down in the list the word is, multiplying that number by the height of the li elements, and then setting the scrollTop property of the unordered list to that.


I know that answer may sound a bit cryptic, so ask if you need more help.

Link to comment
Share on other sites


  • Create New...