Simon Willison’s Weblog


PHP and Javascript spell checker

18th March 2003

Last week I commented that Sam Ruby’s spell checking feature could be made even funkier with the addition of a javascript powered “corrections” menu. I spent a few hours this afternoon playing with the idea, and I’ve now got quite a nice proof of concept:

Spell Checker Demo

I’ve tested it on Phoenix and IE5 on Windows—I’ll check it on IE6 later on this evening. IE5 gets the menus in the wrong place but other than that it seems to work fine in both browsers. I adapted Sam’s Python code for PHP on the server side, while the client side bit is a whole lot of messing around with the DOM.

If you want to nose around the source code, take a look at this lot:

There are still a few bugs, and I haven’t quite worked out an elegant way to get the menus to behave more like menus, but on the whole it’s worked out pretty well.

This is PHP and Javascript spell checker by Simon Willison, posted on 18th March 2003.

Next: Great new bookmarklets

Previous: Flash Functionality not quite so flash

Previously hosted at