脚本脚本说明:
第一步:把如下代码加入<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(" ")) !
站内搜索脚本例子四(javascript)
80酷酷网 80kuku.com