Three powerful features implemented with ASP (i)

Source: Internet
Author: User
Tags copy return
Three powerful features implemented with ASP

1. Add spell checker to your Web site

Many developers have raised the issue of "How to spell Check user input", and this article provides a useful way to discuss how to use the Xde spelling checker, which can be used as both a spell inspector and a dictionary. One good news about this component is that it can be used on the server side or as a Java applet. But one thing, these conveniences are not free, it costs about 100 dollars. However, the component provides a 30-day free use evaluation version, so before you really decide to buy, you can carefully test to see if it meets your needs.

First, visit the http://mirrordns.com/download/site, enter some information (name, email, etc.) and download and install the component. Next, download the "Quick Spell Check full Install" project from the many XDE components available for download. When the download is complete, install it. Before the Setup program is complete, a registration menu appears, and simply select the default selection "Evaluation Period".

Note that the current program is still a beta version. If you do not wish to have a potential error, I propose to wait until the first official version comes out and then download the test. I have found some errors in the existing version. Keep in mind: This is a beta version, not applied on the official site.

Next, prepare to register the registration component. Now decide if you want to include the Dictionary and dictionary features of Word 97, if necessary, install Word 97 or Word 2000 on the Web server, and then refer to the Http://mirrordns.com/spellchecker/server_ Installation.htm's instructions perform a special set of commands. If you do not want to use the entire Word 97 dictionary, just like registering other components:

Copy DLL file SpellCheckServer.dll to Windows system or System32 directory

Registering components with regsvr32: regsvr32 spellcheckserver.dll

Now that you have installed the components, you can use them in your ASP code. To create an example that uses the spelling checker object, simply write the following code:

Set Objspellcheck = Server.CreateObject ("Spellcheck.clschecker")

As I mentioned earlier, this component provides spelling checker and dictionary functionality. First, let's look at how to return a series of synonyms for a given word. This uses the Lookupsynonym method, which requires a parameter, which is a word that needs to look for synonyms. After execution, the spelling checker objects collect related words to the collection object Synonymwords. Execute the following code to return all synonyms for the "Quick" Word:

<%

Dim Objspellchecker, Iloop
' Create An instance of the Spellchecker
Set Objspellcheck = Server.CreateObject ("Spellcheck.clschecker")
Objspellchecker.usemsword = False ' We ' re not using MSWord
objspellchecker.lookupsynonym "Quick" ' Lookup the synonym for ' quick '
' Loop through the returned words:
Response.Write "The following synonyms for ' Quick ' exist:"
For iloop = 1 to Objspellchecker.synonymwords ("Quick"). Suggestedwords.count
Response.Write Objspellchecker.synonymwords ("Quick"). Suggestedwords (iloop). Word
Response.Write ""
Next

%>


Performing a spell check on the server side is very compact for the code structure, but as I see it, you have to rely on the spelling checker in Java applet form to play a powerful function. The following will focus on how to apply this approach, see http://mirrordns.com/spellchecker/for a method of using components on the server side.

In order to use Java applets, you need to copy the. class file under the installation directory to a Web accessible directory. For example, move the file to the/spellcheck directory here. Then, create a form that contains a text box or text field that you want to check for spelling.

< html>

< body>

< FORM name= "Frmspellcheckexample" >
< textarea name= "Javatextarea" rows= "8" cols= "M" >< p>
< INPUT type= "button" value= "Start Spell Check" onclick= "spellcheck ();" >

Next, use the applet tag to refer to the Java applet:

< applet codebase = "/spellcheck/" code= "Spellcheck.class"
height= "1" name= "spellcheck" width= "1"
alt= "Applet not Displayed" >
< param name= "foreground" value= "FFFFFF" >
< param name= "background" value= "008080" >
< param name= "label" value= "This string is passed from the HTML host." >

Note: The codebase parameter in the applet tag points to the directory where the. class file resides.

Finally, use a section of JavaScript code on the client to assemble the applet parameters:

< script language= "JavaScript" >

function SpellCheck () {
Document.spellcheck.ptexttocheck =
Document.frmSpellCheckExample.JavaTextArea.value;
DOCUMENT.SPELLCHECK.DODLG ();
if (document.spellcheck.fixedtext!= "") {
Document.frmSpellCheckExample.JavaTextArea.value =
Document.spellcheck.fixedtext;
}

}
It's done! If you want to learn more about how to use this component and Java applets, be sure to take a look at the places below: http://mirrordns.com/spellchecker/.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.