第一步:把如下代码加入%26lt;body%26gt;区域中
%26lt;script language=%26quot;javascript%26quot;%26gt;
var key = %26quot;%26quot;;
function makeEntry (){
this.Name=%26quot;%26quot;;
this.URL = %26quot;%26quot;;
this.Desc = %26quot;%26quot;;
this.Category = %26quot;%26quot;;
this.Target = %26quot;%26quot;;
return this;
}
function makeArray(n) {
this.length = n;
for (var k = 1; k %26lt;= n; k++) {
this[k] = %26quot;%26quot;;
}
return this;
}
function makeLinks(size) {
this.length = size;
for (var r=1; r%26lt;= size; r++) {
this[r] = new makeEntry();
this[r].Name = namesArray[r];
this[r].URL = urlsArray[r];
this[r].Desc = descArray[r];
this[r].Category = categoryArray[r];
this[r].Target = targetArray[r];
}
return this;
}
var linksize=0
datesArray = new makeArray(linksize);
namesArray = new makeArray(linksize);
urlsArray = new makeArray(linksize);
descArray = new makeArray(linksize);
categoryArray = new makeArray(linksize);
targetArray = new makeArray(linksize);
var arraycount=0
%26lt;!-- 数据库部分由此开始 --%26gt;
arraycount += 1
urlsArray[arraycount] = %26quot;http://java2000.126.com%26quot;
namesArray[arraycount] = %26quot;java脚本资源站Chinese-GB%26quot;
descArray[arraycount] = %26quot;java, javascript, scripts, applet, html, dhtml ,activex, midi, search, downloads, 脚本, free, 免费资源%26quot;
categoryArray[arraycount] = %26quot;最酷的java脚本资源站,大量详细的java源代码和实例说明!%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://members.aol.com/MASTER54X/Anime.html%26quot;
namesArray[arraycount] = %26quot;Anime Master%26quot;
descArray[arraycount] = %26quot;anime master, anime, project a-ko, vampire hunter D, tenchi muyo, bubblegum crisis, sailor moon, sailormoon, gunsmith cats, slayers, all purpose cultural cat girl nuku nuku, plastic little, devil hunter yohko, iria: zeiram the animation, iria, ranma 1/2, ranma, fist of the north star, multimedia, galleries, pic galleries, picture gallery, image gallery, image galleries%26quot;
categoryArray[arraycount] = %26quot;Multimedia, Image galleries for project a-ko, vampire hunter D, tenchi muyo, bubblegum crisis, sailormoon, gunsmith cats, slayers, all purpose cultural cat girl nuku nuku, plastic little, devil hunter yohko, iria: zeiram the animation, ranma 1/2, and fist of the north star.%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://www.geocities.com/Tokyo/Towers/6508/%26quot;
namesArray[arraycount] = %26quot;The Anime Shrine%26quot;
descArray[arraycount] = %26quot;the anime shrine, anime shrine, anime, the anime shrine, anime shrine, manga, saintseiya, fushigiyuugi, fushigi yuugi, evangelion, neon genesis evangelion, eva, ranma, ranma 1/2%26quot;
categoryArray[arraycount] = %26quot;this is a fairly large site with large image galleries from many dif animes, many links, gives out awards, has 3 voting shrines, also sub-Shrines for Fushigi Yuugi, SaintSeiya, Evangelion, and Ranma 1/2. And much more! Must see!%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://home.taegu.net/~virus/%26quot;
namesArray[arraycount] = %26quot;Evangelion Site%26quot;
descArray[arraycount] = %26quot;evangelion site, anime, evangelion, neon genesis, neon genesis evangelion, eva, neon, genesis%26quot;
categoryArray[arraycount] = %26quot;This site is about evangelion, but available in Korean only...%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://animeonline.org/%26quot;
namesArray[arraycount] = %26quot;The Animeonline Network%26quot;
descArray[arraycount] = %26quot;the animeonline network, anime, animecca, news, information, anime magazine, magazine, zine, e-zine%26quot;
categoryArray[arraycount] = %26quot;Your Online Anime Magazine!%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://www.visi.com/~vdgaijin/gaijin.html%26quot;
namesArray[arraycount] = %26quot;Psychommu Gaijin Anime E-zine%26quot;
descArray[arraycount] = %26quot;psychommu gaijin anime e-zine, anime, music, links, news, information, e-zine, zine%26quot;
categoryArray[arraycount] = %26quot;Our aim is to provide you with news and information on some of the coolest aspects of Anime. Old and new! So come on in and enjoy!%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://the.animearchive.org/%26quot;
namesArray[arraycount] = %26quot;Ultimate Animanga Archive%26quot;
descArray[arraycount] = %26quot;ultimate animanga archive, anime, manga, images, pictures, image gallery, midi, image galleries, music, chat, information, descriptions, info%26quot;
categoryArray[arraycount] = %26quot;Searchable page of images, info, and descriptions of anime OAVs and series.%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://otakuworld.com/%26quot;
namesArray[arraycount] = %26quot;Otaku World%26quot;
descArray[arraycount] = %26quot;otaku world, anime, manga, desktop themes, anime themes, search engine, link database, web rings, web ring%26quot;
categoryArray[arraycount] = %26quot;One of the largest multimedia anime sources on the web!%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://www.usagi.com%26quot;
namesArray[arraycount] = %26quot;Usagi.com%26quot;
descArray[arraycount] = %26quot;usagi.com, anime, manga, links, link, database, tenchi, tenchi muyo, download, multimedia%26quot;
categoryArray[arraycount] = %26quot;Your guide to the online anime community!%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
arraycount += 1
urlsArray[arraycount] = %26quot;http://www.si.hhs.nl/~v962343/home.html%26quot;
namesArray[arraycount] = %26quot;Richie's Place%26quot;
descArray[arraycount] = %26quot;richie's place, anime, manga, pictures, pics, movies, links, gif animations, animation, hentai, java, link%26quot;
categoryArray[arraycount] = %26quot;Richie's Place! Over 30 pages! with a picture gallery, movies, gif animations, games, java and more.%26quot;
targetArray[arraycount] = %26quot;target=_blank%26quot;
linksize = arraycount;
// ----数据库结束 ------
// ----以下是输出结果检索结果的页面代码 ----
function searchLinks(links, keyword){
document.write(%26quot;%26lt;BODY fontsize='2' BGCOLOR='#000000' TEXT='#ffffff' LINK='#ccffcc' VLINK='#ffffff'%26gt;%26quot;)
document.write(%26quot;搜索关键字结果: %26lt;strong%26gt;%26quot; +keyword +%26quot;%26lt;/strong%26gt;%26lt;br%26gt;%26lt;br%26gt;%26quot;);
for (var q=1; q%26lt;=links.length; q++) {
if (links[q].URL.toLowerCase().indexOf(keyword) != -1){
document.write(%26quot;%26lt;a href=%26quot; + links[q].URL +%26quot; %26quot; + links[q].Target + %26quot;%26gt;%26quot; + links[q].Name + %26quot;%26lt;/a%26gt; - %26quot;);
document.write( links[q].Category + %26quot;%26lt;br%26gt;%26lt;br%26gt;%26quot;);
continue;
}
if (links[q].Desc.toLowerCase().indexOf(keyword) != -1) {
document.write(%26quot;%26lt;a href=%26quot; + links[q].URL +%26quot; %26quot; + links[q].Target + %26quot;%26gt;%26quot; + links[q].Name + %26quot;%26lt;/a%26gt; - %26quot;);
document.write( links[q].Category + %26quot;%26lt;br%26gt;%26lt;br%26gt;%26quot;);
continue;
}
if (links[q].Name.toLowerCase().indexOf(keyword) != -1) {
document.write(%26quot;%26lt;a href=%26quot; + links[q].URL +%26quot; %26quot; + links[q].Target + %26quot;%26gt;%26quot; + links[q].Name + %26quot;%26lt;/a%26gt; - %26quot;);
document.write( links[q].Category + %26quot;%26lt;br%26gt;%26lt;br%26gt;%26quot;);
continue;
}
}
}
%26lt;/script%26gt;
%26lt;font size=%26quot;5%26quot; color=%26quot;#FF0000%26quot;%26gt;站内搜索引擎%26lt;br%26gt;
%26lt;/font%26gt;%26lt;font color=%26quot;#FF0000%26quot;%26gt; %26lt;font color=%26quot;#000000%26quot;%26gt;测试:输入关键字%26quot;java%26quot;
或中文字符%26quot;免费%26quot; 查询。%26lt;/font%26gt;%26lt;/font%26gt; %26lt;/div%26gt;
%26lt;p align=Center%26gt;
%26lt;form name=%26quot;form%26quot;%26gt;
%26lt;div align=%26quot;center%26quot;%26gt;
%26lt;p%26gt;查询关键字:
%26lt;input type=%26quot;text%26quot; size=20 name=%26quot;search%26quot;%26gt;
%26lt;input type=%26quot;button%26quot; name=%26quot;submit%26quot; value=%26quot;开始查询%26quot; onClick=%26quot;validate_form()%26quot; class=%26quot;pt9%26quot;%26gt;
%26lt;input type=%26quot;reset%26quot; name=%26quot;reset%26quot; value=%26quot;清除%26quot; class=%26quot;pt9%26quot;%26gt;
%26lt;br%26gt;
%26lt;/p%26gt;
%26lt;/div%26gt;
%26lt;/form%26gt;
%26lt;!-- 以下是合法性检测 --%26gt;
%26lt;script%26gt;
function validate_form() {
txt = document.form.search.value;
if (txt.indexOf(%26quot;.%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '.'%26quot;); return;}
if (txt.indexOf(%26quot;,%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a ','%26quot;); return;}
if (txt.indexOf(%26quot;@%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '@''%26quot;); return;}
if (txt.indexOf(%26quot;!%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '!''%26quot;); return;}
if (txt.indexOf(%26quot;#%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '#''%26quot;); return;}
if (txt.indexOf(%26quot;$%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '$''%26quot;); return;}
if (txt.indexOf(%26quot;%%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '%''%26quot;); return;}
if (txt.indexOf(%26quot;^%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '^''%26quot;); return;}
if (txt.indexOf(%26quot;%26amp;%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '%26amp;''%26quot;); return;}
if (txt.indexOf(%26quot;*%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '*''%26quot;); return;}
if (txt.indexOf(%26quot;(%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '(''%26quot;); return;}
if (txt.indexOf(%26quot;)%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a ')''%26quot;); return;}
if (txt.indexOf(%26quot;[%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '[''%26quot;); return;}
if (txt.indexOf(%26quot;]%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a ']''%26quot;); return;}
if (txt.indexOf(%26quot;;%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a ';''%26quot;); return;}
if (txt.indexOf(%26quot;:%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a ':''%26quot;); return;}
if (txt.indexOf(%26quot;%26lt;%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '%26lt;''%26quot;); return;}
if (txt.indexOf(%26quot;%26gt;%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '%26gt;''%26quot;); return;}
if (txt.indexOf(%26quot;?%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '?''%26quot;); return;}
if (txt.indexOf(%26quot;-%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '-''%26quot;); return;}
if (txt.indexOf(%26quot;=%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '=''%26quot;); return;}
if (txt.indexOf(%26quot;+%26quot;) != -1){
alert(%26quot;Search is invalid! Contains a '+''%26quot;); return;}
else {
jsi = new makeLinks(linksize);
searchLinks(jsi, txt);
document.write(%26quot;%26lt;hr%26gt;%26quot;);
document.write(%26quot;%26lt;a href='searchabledb2.htm'%26gt;返回检索页%26lt;/a%26gt;%26lt;br%26gt;%26lt;br%26gt; %26quot;);
//将searchabledb2.htm替换为检索页的URL,以便访问者返回检索页。
}
}
%26lt;/script%26gt;

