站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Javascript 专题JavaScript实例 站内搜索例子 (二)

JavaScript实例 站内搜索例子 (二)

摘要: JavaScript实例 站内搜索例子 (二)
脚本说明:
第一步:把如下代码加入<body>区域中
<form name="database">
<input type="hidden" name="list" value=http://www.webcrawler.com~Webcrawler|keywords for first file go
here separated by spaces^A great search engine from the makers of AOL!*http://java2000.126.com~java2000
collections|java javascript search html download cgi perl dhtml games activex 下载 脚本^coolest java and
javascript collections for internet surfers to enhance web page!
*http://www.javagoodies.com/~javagoodies|ActiveX ASP C/C++ CGI Databases java javascript^coolest
javagoodies!*>
</form>
<p>
<script language="JavaScript">
<!--
version = 1.0;
// -->
</script>
<script language="JavaScript1.1">
<!--
version = 1.1;
// -->
</script>
<script language="JavaScript">
<!--
// When set to true, searching for "fun*y" matches in the string "fun sky".
// (it will also match the string "fun and here is some long dummy text for you"
// which is obviously not what they were looking for, so we suggest you set
// match_across_word_boundaries to false)
// When set to false, the * operator will not match across word boundaries so
// the above example will not match.
match_across_word_boundaries = false; // false is suggested strongly

// ************ NO NEED TO MODIFY ANYTHING BELOW THIS POINT ************

function Page(url,title,keywords) {
while ((url.length > 0) && (url.charAt(0) == " ")) {
url = url.substring(1,url.length);
}
this.url = url;
while ((title.length > 0) && (title.charAt(0) == " ")) {
title = title.substring(1,title.length);
}
this.title = title;
this.keywords = keywords;
return this;
}
function Database() {
var pos = 0;
while ((pos1 = amorphous.indexOf("~",pos)) != -1) {
pos2 = amorphous.indexOf("|",pos1+1);
pos3 = amorphous.indexOf("*",pos2+1);
if ((pos2 != -1)
&& (pos2 < pos3) && (pos3 <= amorphous.indexOf("*",pos))) {
this[database_length++] = new Page(amorphous.substring(pos,pos1),
amorphous.substring(pos1+1,pos2),
amorphous.substring(pos2+1,pos3));
pos = pos3+1;
} else { // error reading amorphous database
if (pos+30 <= amorphous.length)
alert(Error reading in amorphous database around "
+ amorphous.substring(pos,pos+30) + ");
pos = amorphous.indexOf("*",pos) + 1;
}
}
return this;
}
var array = new Object();
array_length = 0; // Netscape 2 fix
var position = new Object();
position_length = 0; // Netscape 2 fix
function pattern(str) {
array_length = position_length = 0;
while ((str.length > 1) && (str.charAt(0) == "*")) {
str = str.substring(1,str.length);
}
while ((str.length > 1) && (str.charAt(str.length-1) == "*")) {
str = str.substring(0,str.length-1);
}
if (str == "*")
return "(true)";
if (str.indexOf("*") == -1) {
array[array_length++] = str;
pat = "(combo.indexOf(array[0]) != -1)";
} else {
left = right = 0;
pat2 = "";
pat = "(((position[0] = combo.indexOf(array[0])) != -1)";
while ((right = str.indexOf("*",left)) != -1) {
array[array_length++] = str.substring(left,right);
pat += " && (position["+(position_length)+"] < (position["
+(++position_length)+"] = combo.indexOf(array["+(array_length)
+"],position["+(position_length-1)+"]+array["+(array_length-1)+"].length"+")))";
if (!match_across_word_boundaries)
pat2 = " && (no_back_up = ((back_up_pos += combo.substring("
+"temp_pos = back_up_pos = position["
+(position_length-1)+"]+array["+(array_length-1)+"].length,position["
+ (position_length) + "]).lastIndexOf( )) < temp_pos))" + pat2;
left = right+1;
}
array[array_length++] = str.substring(left,str.length);
pat += pat2+")";
}
return pat;
}
function search(str) {
menu_length = 0;
temp = new Object();
temp_length = 0;
words_length = 0;
words = new Object();
pos = 0;
while ((pos = str.indexOf(" ")) != -1
&& and_search != "exact") {
words[words_length] = str.substring(0,pos);
if (words[words_length].length > 0)
words_length++;
if (str.length == 1)
str="";
else
str = str.substring(pos+1,str.length);
}
if (str.length > 0)
words[words_length++] = str;
for (q=0;q<words_length;q++) {
temp_length = 0;
str = words[q].toLowerCase();
pattern_string = pattern(str);
start_pos = back_up_pos = 0;
len = (and_search=="and"&&q>0?menu_length:database_length);
for (n=0; n<len; n++) {
no_back_up = true;
position_length = 0;
if (and_search=="and"&&q>0) {
combo = (menu[n].title + " " + menu[n].keywords).toLowerCase();
} else {
combo = (database[n].title + " " + database[n].keywords).toLowerCase();
}
combo = combo.substring(start_pos,combo.length);
if (eval(pattern_string)) { // found
temp[temp_length++] = (and_search=="and"&&q>0?menu[n]:database[n]);
start_pos = 0;
} else if (!no_back_up) { // try pattern again in new spot
n--;
start_pos += back_up_pos+1;
} else { // not found
start_pos = 0;
}
}
if (and_search!="and" && q>0) {
added = 0;
for (i=0;i<temp_length;i++) {
duplicate = false;
for (j=0;j<menu_length&&!duplicate;j++) {
if (menu[j] == temp[i]) {
duplicate = true;
}
}
if (!duplicate)
menu[menu_length+(added++)] = temp[i];
}
menu_length += added;
} else {
for(h=0;h<temp_length;h++)
menu[h] = temp[h];
menu_length = temp_length;
}
}
}
function entry() {
if ((document.entryform.keyword.value.length == 0)
|| (document.entryform.keyword.value == " ")) {
alert("First you must enter a keyword to search for.");
return false;
}
and_search = (document.entryform.and_or.selectedIndex == 0?"and":"or");
if (document.entryform.and_or.selectedIndex == 2)
and_search = "exact";
if (version >= 1.1) {
search(document.entryform.keyword.value);
if (menu_length == 0)
menu[menu_length++] = new Page("","Not found!","");
document.display.found.options.length = menu_length;
for (n=0; n<menu_length; n++) {
if (menu[n].title.length <= 50)
document.display.found.options[n].text = menu[n].title;
else
document.display.found.options[n].text = menu[n].title.substring(0,50);
document.display.found.options[n].value = menu[n].url;
}
} else {
location.href = location.pathname + "?"
+ escape(document.entryform.keyword.value)
+ (and_search != "or"?"&"+and_search:"");
}
return false;
}
function go_there() {
sel = document.display.found.selectedIndex;
if ((sel != -1) && (document.display.found.options[sel].value.length > 0))
location.href = document.display.found.options[sel].value;
}

var amorphous = document.database.list.value;
temp_str = amorphous.substring(amorphous.length-2,amorphous.length);
if (temp_str.indexOf("*") == -1)
amorphous += "* ";
else
amorphous += " "; // amorphous database must have characters after last asterisk

database_length = 0; // Netscape 2 fix
var database = new Database(); // read in from amorphous database

menu_length = 0; // Netscape 2 fix
var menu = new Object();

string = "";
and_search = "or";
if (location.search.length > 1) {
string = unescape(location.search.substring(1,location.search.length));
pos = 0;
while ((pos = string.indexOf(",pos)) != -1) {
string = string.substring(0,pos) + \\" + string.substring(pos+1,string.length);
pos += 2;
}
if (string.substring(string.length-4,string.length) == "&and") {
string = string.substring(0,string.length-4);
and_search = "and";
} else if (string.substring(string.length-6,string.length) == "&exact") {
string = string.substring(0,string.length-6);
and_search = "exact";
} else if (string.substring(string.length-3,string.length) == "&or") {
string = string.substring(0,string.length-3);
and_search = "or";
}
search(string);
}
document.write(<form name="entryform" class="pt9" onSubmit="return entry()">
+Search for: <input type="text" type="pt9" size=15 name="keyword" value="+string+">
+<input type="button" class="pt9" value="Search" onClick="entry()"><br><select name="and_or"
+size=1><option+(and_search=="and"?" selected":"")+>AND查询
+(AND)<option+(and_search=="or"?" selected":"")+>OR查询
+(OR)<option+(and_search=="exact"?" selected":"")+>完全
+匹配</select><br>""可以使用通配符</form><br>
+<form name="display"><select name="found" size=5>\n);
for (n=0; n<menu_length; n++)
document.write(<option value="+menu[n].url+">+menu[n].title+\n);
if ((menu_length == 0) && (location.search.length <= 1))
document.write(<option value="" class="pt9">Enter a search keyword above\n);
else if ((menu_length == 0) && (location.search.length > 1))
document.write(<option value="">关键字"
+location.search.substring(1,location.search.length)+"没有发现!\n);
document.write(</select><br><input type="button" class="pt9" onClick="go_there()"
+value=" Go There "></form>);
// -->
</script>

脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide Script from Old Browsers
Keyword = new Object();
Descrip = new Object();
Address = new Object();

// Keyword[0] = n (where n is the number of keywords which can be searched
Keyword[0] = 5 //对应查询组的数量;

Keyword[1] = "javascript"
Descrip[1] = "最全的javascript资源站-javascript2000.com"
Address[1] = "http://www.javascript2000.com"

Keyword[2] = "javascript"
Descrip[2] = "很好的javascript站点"
Address[2] = "http://www.cnlot.com/"

Keyword[3] = "javascript"
Descrip[3] = "java神捕"
Address[3] = "http://pcafei.3322.net/"

Keyword[4] = "javascript"
Descrip[4] = "精彩天地"
Address[4] = "http://demoy.3322.net/"

Keyword[5] = "javascript"
Descrip[5] = "国外最大的javascript资源站"
Address[5] = "http://www.javascript.com/"
function checkDatabase() {

var Found = false
var Item = document.forms[0].searchfor.value.toLowerCase();

stats=toolbar=no,location=no,directories=no,status=no,menubar=no,
stats += scrollbars=yes,resizable=yes
MsgBox = window.open ("","msgWindow",stats)
MsgBox.document.write("<head><title>查询结果</title></head>");
MsgBox.document.write ("<BODY BGCOLOR=#ffffff TEXT=#000000 LINK=#000080 VLINK=#800040
ALINK=#FF0000><CENTER>查询结果</CENTER>")
MsgBox.document.write ("For the keyword: "+Item+"<HR>");
for (var i=1; i <= Keyword[0]; i++) {
if(Item == Keyword[i]) {
Found = true;
MsgBox.document.write (Descrip[i]+"<BR><A HREF="+Address[i]+">Click Here To View</A><br>")

}
}
if(!Found)
MsgBox.document.write ("没有发现与该关键词有关的条目。")
MsgBox.document.write ("<H6>Enjoy it!<BR><A HREF=http://java2000.126.com>http://java2000.126.com</A></H6>")
MsgBox.document.write ("<FORM class=pt9><CENTER>")
MsgBox.document.write ("<INPUT type=button value=关闭查询窗口 onClick = self.close()>")
MsgBox.document.write ("</CENTER></FORM>") }
// -->
</SCRIPT>

如下代码生成查询表单界面:

<form name="form1">
<u>请输入查询关键词:</u><br>
<input type="text" name="searchfor" value="" size=20>
<input type="button" value="查询" onClick="checkDatabase()" name="button">
<br>
<!-- End Of File -->
<font color="#FF0000">输入小写字符</font>
<p>
</form>

脚本说明:
第一步:把如下代码加入<body>区域中
<script language = "JavaScript">
var key = "";
function makeEntry ()
{
this.Name="";
this.URL = "";
this.Desc = "";
return this;
}

function makeArray(n)
{
this.length = n;
for (var k = 1; k <= n; k++)
{
this[k] = "";
}
return this;
}

function makeLinks(size)
{
this.length = size;
for (var r=1; r<= size; r++)
{
this[r] = new makeEntry();
this[r].Name = namesArray[r];
this[r].URL = urlsArray[r];
this[r].Desc = descArray[r];
}
return this;
}

var linksize=0;

namesArray = new makeArray(linksize);
urlsArray = new makeArray(linksize);
descArray = new makeArray(linksize);

var arraycount=0;

<!-- 以下是数据库部分,随意添加和删除-->
arraycount += 1
urlsArray[arraycount] = "http://nettrain.163.net/java/navigation/newscript.htm"
namesArray[arraycount] = "网际快车Java脚本资源站"
descArray[arraycount] = "java javascript applet games activex asp cgi databases search media dw2 midi
music menu html dhtml intranet internet scripts games perl downloads password cookies free graphics
freescripts calander dw2 flash plugins 脚本 密码保护页 脚本 免费资源 主页制作技巧 下载 搜索引擎 表单递交 插
件 教学 动态页面 图形图象 多媒体"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/desktop/adc120.html"
namesArray[arraycount] = "Advanced Disk Catalog v1.20 beta 1"
descArray[arraycount] = "Catalog your disks, folders and files"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/tools/azpr.html"
namesArray[arraycount] = "Advanced ZIP Password Recovery v0.91a"
descArray[arraycount] = "Recover lost password for encrypted ZIP file"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/AdveWith.html"
namesArray[arraycount] = "Adventures With Chickens 2.01"
descArray[arraycount] = "A Christian Windows-95 Arcade/Adventure Game"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/INV58FUL.html"
namesArray[arraycount] = "Alien Invasion 1.0"
descArray[arraycount] = "Action Game for players with disabilities"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/ayatze22.html"
namesArray[arraycount] = "All In One Yahtzee v2.2"
descArray[arraycount] = "Advanced yahtzee game with 5 variations."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/atris_10.html"
namesArray[arraycount] = "Alphatris v1.0"
descArray[arraycount] = "Arcade style word game for windows 95"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/amg32setup.html"
namesArray[arraycount] = "Amigo! v2.2 "
descArray[arraycount] = "Internet Enabled, Free Form PIM"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/32anbj12.html"
namesArray[arraycount] = "Animated Blackjack v1.2"
descArray[arraycount] = "A realistic game with great graphics.."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/95ani12.html"
namesArray[arraycount] = "Animated Slots v1.2"
descArray[arraycount] = "A fun 5 wheel slot machine with great graphics.."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/pie184.html"
namesArray[arraycount] = "ApplePie Pro HTML Editor 1.8.4"
descArray[arraycount] = "Tag highlighting, JavaScript, Homepage Wizard"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/tools/apackmk1.html"
namesArray[arraycount] = "arclab Packager MK1 1.2.0.61"
descArray[arraycount] = "Split one or more files into packages"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/bbsetup.html"
namesArray[arraycount] = "BrainsBreaker 2.1"
descArray[arraycount] = "Create and play jigsaw puzzles in Windows95"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/business/bs1sb.html"
namesArray[arraycount] = "BS1 Small Business v1.1"
descArray[arraycount] = "Bill customers, pay vendors, and manage accounting"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/bubble97.html"
namesArray[arraycount] = "Bubble Puzzle 97 v1.1g"
descArray[arraycount] = "Bubble Puzzle 97 from Conmeg. Bust-a-move clone."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/business/bfsnf216.html"
namesArray[arraycount] = "Budget for Success Win95 v2.16"
descArray[arraycount] = "Budget databases, mortgages, investment planner."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/program/bc10.html"
namesArray[arraycount] = "Bug Collector 1.0"
descArray[arraycount] = "Manage feature requests and problem reports easier."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/games/bzzz_1_01.html"
namesArray[arraycount] = "Bzzz! 1.01"
descArray[arraycount] = "Win95 Game Control a frog to catch flies."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/cachekil.html"
namesArray[arraycount] = "Cache Killer Pro 1.4"
descArray[arraycount] = "Clean up Internet Cache folders"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/business/cal9107b.html"
namesArray[arraycount] = "Calendar+ v1.07.00"
descArray[arraycount] = "Appointment scheduler and to do minder"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/business/cb32.html"
namesArray[arraycount] = "Calendar Builder v2.2b"
descArray[arraycount] = "Quickly and easily make your own custom calendars."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/multi/cdm160.html"
namesArray[arraycount] = "CDMaster v1.6"
descArray[arraycount] = "CDPlayer w/Dubbing and Picture Attachment"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/cgixpert.html"
namesArray[arraycount] = "CGI Expert 3.03"
descArray[arraycount] = "CGI/ISAPI/NSAPI component suite for Delphi and C++"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/tools/clox_5.html"
namesArray[arraycount] = "CLOX v1.3"
descArray[arraycount] = "Gives you world times on your desktop"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/desktop/snow_wi.html"
namesArray[arraycount] = "D2G Snow screen saver v1.00"
descArray[arraycount] = "Displays snow falling on a starry night w/snowman."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/dbQuickPage.html"
namesArray[arraycount] = "dbQuickPage 1.1"
descArray[arraycount] = "Database to HTML conversion for the Web."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/misc/ftrim21.html"
namesArray[arraycount] = "Final Trim v2.1"
descArray[arraycount] = "A Win95 WWII Submarine Multimedia Publication"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/np25.html"
namesArray[arraycount] = "NetPopup 2.51"
descArray[arraycount] = "Messaging tool for Networks"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/inet/nmong144.html"
namesArray[arraycount] = "NewsMonger Search Agent 1.44"
descArray[arraycount] = "Automatically monitor newsgroups for keywords"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/tools/notebk32.html"
namesArray[arraycount] = "Notebook v5.1"
descArray[arraycount] = "Large file text editor."

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/commun/nprsv15.html"
namesArray[arraycount] = "NotePager 1.5"
descArray[arraycount] = "An easy to use alphanumeric paging software"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/multi/ntrack10.html"
namesArray[arraycount] = "n-Track v1.5.2"
descArray[arraycount] = "An audio/MIDI shareware multitrack recorder"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/business/sd20.html"
namesArray[arraycount] = "SecurDesk! 2.0"
descArray[arraycount] = "Security environment and utilities for Win 95/NT"

arraycount += 1
urlsArray[arraycount] = "http://www.win-shareware.com/desktop/yapla16.html"
namesArray[arraycount] = "Yapla V1.6"
descArray[arraycount] = "YAPLA - Yet Another Program Launcher"

linksize = arraycount;

function searchLinks(links, keyword, hits, dirw)
{
var resultcount=0;
<!-- 如下是生成查询结果显示页面!外观自己可以修改相应代码即可! -->
document.write(<HTML>);
document.write(<BODY BGCOLOR=#000000 TEXT=white LINK=yellow VLINK=yellow ALINK=yellow>);
document.write(<CENTER><TABLE BORDER=3 CELLSPACING=0 CELLPADDING=3 BGCOLOR=\"#ff0000
\"><TR><TD><CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3 BGCOLOR=\"#42526B\"><TR><TD>);
document.write("<CENTER><font color=red>Results for keywords: </font><font size=5 color=yellow>"
+keyword +"</font></CENTER>");
document.write(</TD></TR></TABLE></CENTER></TD></TR></TABLE></CENTER><P>);
document.write(<OL>);
for (var q=1; q<=links.length; q++)
{
if (links[q].URL.toLowerCase().indexOf(dirw) != -1)
{
if (links[q].Desc.toLowerCase().indexOf(keyword) != -1)
{
resultcount += 1;
if (resultcount > hits)
{
break;
}
else
{
document.write("<LI>");
document.write("<a href=\"" + links[q].URL + "\">" + links[q].Name + "</a>");
document.write(" -" + links[q].Desc + "<br>");
continue;
}
}
if (links[q].Name.toLowerCase().indexOf(keyword) != -1)
{
resultcount += 1;
if (resultcount > hits)
{
break;
}
else
{
document.write("<LI>");
document.write("<a href=\"" + links[q].URL + "\">" + links[q].Name + "</a>");
document.write(" -" + links[q].Desc + "<br>");
continue;
}
}
}
}

}

</script>
<script>
<!-- 如下是表单合法性检查,主要是避免一些非法字符的查询! -->
function validate_form()
{
txt = document.form.search.value;
newindex = document.form.numhits.selectedIndex;
dahits = document.form.numhits[newindex].value;
newindexb = document.form.whichdir.selectedIndex;
dadir = document.form.whichdir[newindexb].value;
if (txt.indexOf(".") != -1){
alert("Search is invalid! Contains a ."); return;}
if (txt.indexOf(",") != -1){
alert("Search is invalid! Contains a ,"); return;}
if (txt.indexOf("@") != -1){
alert("Search is invalid! Contains a @"); return;}
if (txt.indexOf("!") != -1){
alert("Search is invalid! Contains a !"); return;}
if (txt.indexOf("#") != -1){
alert("Search is invalid! Contains a #"); return;}
if (txt.indexOf("$") != -1){
alert("Search is invalid! Contains a $"); return;}
if (txt.indexOf("%") != -1){
alert("Search is invalid! Contains a %"); return;}
if (txt.indexOf("^") != -1){
alert("Search is invalid! Contains a ^"); return;}
if (txt.indexOf("&") != -1){
alert("Search is invalid! Contains a &"); return;}
if (txt.indexOf("*") != -1){
alert("Search is invalid! Contains a *"); return;}
if (txt.indexOf("(") != -1){
alert("Search is invalid! Contains a ("); return;}
if (txt.indexOf(")") != -1){
alert("Search is invalid! Contains a )"); return;}
if (txt.indexOf("[") != -1){
alert("Search is invalid! Contains a ["); return;}
if (txt.indexOf("]") != -1){
alert("Search is invalid! Contains a ]"); return;}
if (txt.indexOf(";") != -1){
alert("Search is invalid! Contains a ;"); return;}
if (txt.indexOf(":") != -1){
alert("Search is invalid! Contains a :"); return;}
if (txt.indexOf("<") != -1){
alert("Search is invalid! Contains a <"); return;}
if (txt.indexOf(">") != -1){
alert("Search is invalid! Contains a >"); return;}
if (txt.indexOf("?") != -1){
alert("Search is invalid! Contains a ?"); return;}
if (txt.indexOf("=") != -1){
alert("Search is invalid! Contains a ="); return;}
if (txt.indexOf("+") != -1){
alert("Search is invalid! Contains a +"); return;}
else
{
jsi = new makeLinks(linksize);
searchLinks(jsi, txt, dahits, dadir);
document.write(</OL>);
document.write(<font color=red>....... 查询结果结束 .......</font><P>);
document.write(<hr>);
document.write(</body></html>);
}

}
</script>

<table width=59% border=1 cellpadding=0 cellspacing=0 align=center valign=top>
<tr>
<td width=100% align=left bgcolor=#42526B height="232">
<form name="form">
<center>
<font color="yellow"> </font>
</center>
<center>
<font color="yellow">关键字(小写字符,支持中文):</font> <font color="yellow"><b>
<input name="search" type=text size="20">
</b> </font>
</center>
<font color="yellow"><b><br>
</b> </font>
<center>
<font color="#FFFF00">返回记录数:</font> <font color="yellow"><font face="Arial, Helvetica,
sans-serif">
<select name="numhits" size="1">
<option selected value="25">25
<option value="50">50
<option value="75">75
<option value="100">100
<option value="150">150
<option value="200">200
</select>
</font>检索分类<font face="Arial, Helvetica, sans-serif"> </font><b><font
size=3><font size=3>
<select size=1 name="whichdir" class="pt9">
<option selected value="http">ALL
<option value="java">javaScript
<option value="business">Business
<option value="commun">Communications
<option value="desktop">Desktop
<option value="educate">Education
<option value="games">Games
<option value="graphics">Graphics
<option value="hobby">Hobby
<option value="homeuse">Home Use
<option value="inet">Internet
<option value="multi">Multimedia
<option value="program">Programming
<option value="tools">System Tools
</select>
</font></font> </b> </font>
</center>
<font color="yellow"><b><font size=3><font size=3> <br>
<br>
</font></font></b></font><font color=yellow size=3><font color=yellow size=3>
<center>
<font color="yellow"><b>
<input type="button" name="submit" value="Search" onClick="validate_form()">
<input type="reset" name="reset" value=" Clear ">
</b> </font>
</center>
</font></font>
</form>



↑返回目录
前一篇: 在Javascript中为String对象添加trim,ltrim,rtrim方法
后一篇: JavaScript实例 站内搜索例子 (一)