The code behind this is very simple. Just a few things to remember. The variable k is the number of words in your word list. The variable elnum is the element number. It must be given when the onBlur event is called. Element numbers are defined by the order in which the elements were declared, starting with 0. In English, that means that your first <INPUT> tag is element 0, your second <INPUT> tag is element 1, and so on. That's why if you view the source code, you'll find that I have written checkForProfanity(0) because this field is defined with the first <INPUT> tag.

Now, try typing in a swear word. The program doesn't like it. Future versions will include window closing after three attempts at typing profanity.