This is the second version of checkForProfanity. It still checks to make sure that no bad words are entered, but this one is much easier to use. Just copy the code for the onBlur event exactly as shown:

onBlur = "this.value = checkForProfanity(this.value);"

and stick it in the <INPUT> tag. That's all.

Also, the variables are easier to use:

message is a variable that holds the message that will overwrite the contents of the <INPUT> tag if a swear word is written.

numberOfWords is the total number of swear words that you do not want to appear in the text box. To add more words, just add to the array as the code shows.

If anyone has any problems with this script, or wants any advice of JavaScript, e-mail me at cacho@skynet.ca


Now enough talk, try typing a swear word in that field.