这个函数可以利用MS Word来检查拼写错误,当然只对E文有效, 如果Microsoft在中关村我想它对中文肯定是可以的。
<HTML> <HEAD> <TITLE> Spell checker</TITLE> <SCRIPT LANGUAGE=vbscript> <!-- Function SpellChecker(TextValue) Dim objWordobject Dim objDocobject Set objWordobject = CreateObject("word.Application") objWordobject.WindowState = 2 objWordobject.Visible = True
Set objDocobject = objWordobject.Documents.Add( , , 1, True)
objDocobject.Content=TextValue objDocobject.CheckSpelling
SpellChecker = objDocobject.Content objDocobject.Close false Set objDocobject = Nothing objWordobject.Application.Quit True Set objWordobject= Nothing
End Function
Sub cmdOk_onclick() Dim strValue strValue = frmDemo.txtEditor.value frmDemo.txtEditor.value = SpellChecker(strValue) Msgbox "原文是 :" & strValue End Sub --> </SCRIPT> </HEAD> <BODY> <FORM action="" method=post id=frmDemo name=frmDemo> <P><TEXTAREA id=txtEditor style="WIDTH: 665px; HEIGHT: 217px" name=txtEditor rows=11 cols=73></TEXTAREA> </P> <input name=cmdOk value=Ok onclick="cmdOk_onclick" type=button> </Form> </Body> </HTML>
|