September 13, 2006
by: jovial_cynic
I wrote a spellcheck script in javascript for a publishing application I wrote at work. It taps into the Microsoft Word object for the actual dictionary file and pretty much functions the way a spellchecker should once you hit "check spelling" or whatever. If you don't have MS Office installed, this script won't work. Oh, and it only works with IE., since it's using activeX. I don't like to code IE-only scripts, but since my work environment is solely Microsoft, that's what I get to code all day.

Anyhow, the script is about 98% functional. It doesn't deal well with ampersands (&) at this time -- so I'm having it just treat them like a misspelled work that you can choose to either ignore or change.

Here's the zip file.

The spellCheck.htm is the primary file, and the text to be checked is inside the "contentEditor" div tag.

NOTE: You have to have the text in the div tag also inside another tag. That is, make a paragraph tag inside the div tag and keep your content inside the paragraph tags. Otherwise, the spellchecker won't know that there's anything to check. That's a bit of runoff from the publishing tool I wrote, and the paragraph tags are written automatically.

The spellCheckPopup.htm file is the window that shows up to give you some suggestions for changing your word.


ANOTHER NOTE: I'm sure somebody reading this is thinking, "why would you want a spellchecker to run on in a div tag? You can't edit a div tag."

Yes you can. The publishing tool I'm using at work functions inside an editable div tag, which allows me to post markup (bold, underline, etc., etc.) in realtime, instead of having to make the user type in markup language themselves. sneaky sneaky.
np category: personal


add comments. you are limited to 5,000 characters:

<< your name
<< your email (won't be displayed)
<< your website / location
<< type these numbers: 862582 (plus 0NE)

(html -enabled- / no scripts)

<< Comments temporarily disabled >>

Rules: Don't spam. Don't harrass. Don't be a jerk. Your IP address ( will be logged.