Then you'll need to detect whenever whatever you consider a "word" is complete.
Also, please be sure to take the time to compose descriptive subjects for your posts;
read this for more information.
Using a title of "how can i do this in javascript?" in a forum completely dedicated to questions on JavaScript isn't very helpful.
Please go back and change your post to add a more meaningful subject by clicking the