OpenNTF.org - Web based spell checker
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Web based spell checker 
Rating:
Not Rated Yet 
Contributor:
Landa Rodgers 
Category:
Javascript 
Type:
Webdevelopment 
Notes Version:
R6.x, R5.x, R7.x 
Last Modified:
06 Jun 2006 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Simple script uses MS word's spellcheck to spell check web based forms. Validates text fields only.


Disclaimers: MS word should not be open on desktop when using - may cause problems. Program is used on internal web sites. Will not go across firewall.

Usage / Example
function startspellcheck() {
if (document.forms[0].length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if (field.elements[i].type == "textarea") {
fieldname=document.forms[0].elements[i].name;
text = document.forms[0].elements[i].value;
if (text != "") {
spellcheck(text, fieldname);
}
}
}
}
}


function spellcheck(text, fieldname) {
oShell= new ActiveXObject("WScript.Shell");
oWord= new ActiveXObject("Word.Application");
oWord.Visible= false;
oWord.Documents.Add();
oWord.Selection.TypeText(text);
oWord.ActiveDocument.CheckSpelling();
oWord.Selection.WholeStory();
strtext=oWord.Selection.Text;
oWord.ActiveDocument.Close(0);
oWord.Quit();
fieldname = eval("document.forms[0]." + fieldname );
fieldname.value = strtext;

}
 Comments

No documents found

 Add your comment!