Recommended: ASP example: Production of word combination games This is a game about word coding, written in ASP, VBScript and JavaScript. No major problems were found under test under Win98 OEM2, PWS, and IE5. Usage method: Method 1: For example, the directory of your 3W service is C:Inetpubwwwroot.
Many Internet enthusiasts rack their brains to make the functions of their website more comprehensive when creating their own personal homepage. Here, the author introduces a method to use ASP to build your own search engine.
The basic idea uses forms to store search keywords submitted by users in variables and submit them to ASP scripts for processing. Use the built-in REQUEST object of ASP to obtain the keyword characters in the variable, and then use the RESPONSE REDIRECT function to transfer the keyword characters to other professional search engines such as Sohu and NetEase to obtain the search results. This allows visitors to easily use major search engines on their homepage without logging into their homepage.
The first step is to create the main page of the search engine. Add the code between <body> and < /body> of the HTML file as follows:
| The following is the quoted content: < form name=form1 method=post action=search.asp> < div align=center> Please select your favorite search engine< br>< br> < select name=select size=1> < option>Sohu< /option> < option>Sina (Beijing Station)< /option> < option>NetEase< /option> < /select>< br>< br> Please type the keyword you want to query <br> < input type=text name=textfield> < br>< br> < input type=submit name=Submit style=color:#CC0033;background-color:#ffffff;font-size:9pt;border:#CC0033 1px solid;height:18pxvalue=Search> < /form> |
Here, we provide three search engines: Sohu, Sina and NetEase for users to choose from. After the user types the keyword string, the form submits the request to the search.asp in the background for processing.
The second step is to write the background ASP program. Add the following code between <body> and < /body> of the HTML file:
| The following is the quoted content: < % if request.form(select)=Sohu then response.redirect(http://site.search.sohu.com/ sitesearch.jsp?key_word=&&request.form(textfield)) end if if request.form(select)=Sina (Beijing Station) then response.redirect(http://site.search.sohu.com/ sitesearch.jsp?key_word=&&request.form(textfield)) end if if request.form(select)=NetEase then response.redirect(http://search.163.com/cgi-bin/search/engine/search2.fcgi?lang=gb&&key=&&request.form(textfield)) end if %> |
When submitting search strings to other search engines, it is very important to understand the query formats used by these search engines. For example, Sohu uses http://site.search.sohu.com/sitesearch.jsp?key_word=Search string. We only need to pay attention when using these search engines, record and analyze the addresses in the IE address bar when giving the search results, and remove the following characters such as Liu %... (this is the characters converted into the search string we submitted), and we can get the query format.
In addition, many search engines use classification search. It can be subdivided into categories such as websites, web pages, news, etc. The query formats of each category are different. Readers can use more IF statements to create selections to realize the segmentation of search types within the same search engine.
Similarly, we can also expand this program and add other search engines to make its functions more powerful.
Share: ASP 3.0 Advanced Programming (41) 9.2.3 The use of stored procedures The use of stored procedures is an area in which Command objects are applied. Stored procedures (sometimes called storage queries) are SQL query statements that are predefined in a database. Why should stored procedures be created and used instead of directly using them in code