View Full Version : Javascript spellchecker

12-22-2007, 12:11 AM
I know there are very viable solutions such as IEspell or FFox, but I don't have those options. I can not have users installing other applications/plug-ins.

So I thought that another solution would be JS using a txt file or .dic file containing the English dictionary, words spaced by new lines, and having the spell checker token each word and parse it against the txt file. The function will be triggered by a button click. Not sure how I am going to highlight/focus the word to show the misspelled word and that is why I am here.

Also, my above method is also very gimp/insufficient. A hashtable/other search mechanism would be nice, any suggestions? linear search is dreadful. Common words like 'you', 'to', 'we' will have to traverse over 100,000 words. And the client side nature of JS is unsettling. Perhaps it won't be so bad, each user will be using IE6 and higher (possibly FF) and at least 512 RAM.

Thanks your for input.

12-22-2007, 12:35 AM
vbulletin has a plugin like this that stores the words in a mysql database table. That may help if you can find the table sql file, have just had a look n i can't find it on my hd but i think you can download it from www.vbulletin.org.

12-22-2007, 01:39 AM
Well I suppose I could throw the dictionary into an Access DB table.
But the way my software is working is I am using a ODBiC (open database interenet connector) program (CGI) with my MS Access DB. I am running JS for validation with my htm pages. I can not change this architecture, I would love to, but can not.

I do not have a way of checking the page's current state with ODBiC to check the dictionary table. I.E. I can not pass the document.form.text.value field into my sql script(it uses the <!-- --> commenting and checks for key words for triggers of ODBiC).

And again, I can not have users installing plugins.

12-22-2007, 03:27 AM
simple... Use ajax to talk to php to

Text box --> Ajax --> PHP file --> DB --> PHP --> Ajax --> display what you want
(im sure(maybe?) that ajax works with asp too if thats what you want)

The php file would take the text and check every word and add html to format the color and whatever(links,popups,...) then the php file sends the new text back to the javascript (ajax) and your done!

This looks like what you want:


12-24-2007, 08:13 PM
Well text boxes only have properties that can change the background colors. I need a way to select the text in the box. I'll look into AJAX, always wanted to.

I'll have to look into more types of text areas for capabilities.