一个检查E文拼写错误的Code
发布时间:2006-10-14 2:57:55   收集提供:gaoqian
这个函数可以利用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>

 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50