欢迎你的访问
 
返回天空素材库首页 http://www.Skysucai.com  
收藏本站
将本站设为首页
您当前的位置:天空素材首页 -> 这个脚本将查询的结果显示在了文本框中
 
栏 目 导 航
. 常用代码 . 综合特效
. 状态特效 . 游戏特效
. 页面背景 . 页面特效
. 页面导航 . 文本操作
. 文本特效 . 图形特效
. 鼠标特效 . 时间日期
. 密码特效 . 浏览相关
. 警告对话 . 技巧特效
. 计数转换 . 测试搜索
. 代码生成 . 播放音乐
. 按钮特效 . 系统相关
. 链接特效 . 黑客性质
. 相关特效 . 窗口特效
. 广告特效 . 表单表格
. 模拟例子
相 关 文 章
· 状态栏显示链接内容...
· 又一例闪动的标题栏...
· 让标题栏文字动起来...
· 状态栏显示链接内容...
· 在输入框中输入什么...
· 状态栏打字效果特效...
· 闪动的标题栏特效
· 字符来回出现于状态...
· 在标题栏显示时间特...
· 一款状态滚动的文字...
本 类 热 门
· 问卷调查脚本
· 不错的页面搜索脚本
· 在跳出的对话框中输入...
· 较为简单的搜索器
· 这个脚本将查询的结果...
· 再一个不错的搜索脚本...
· 同样是搜索脚本,好像...
· 又一不错的搜索引行。...
· 若干道试题,自动给出...
· 给出试题,完成后跳窗...
· 一边答题一边就能给出...
· 一边答题一边就能给出...
更多  
 
 
更多  
最 新 推 荐
· 状态栏时间跳动特效
· 农历挂历特效
· 真正的万年历
· 网页特效 菜单-会动的...
· 网页特效 时间-任意位...
· 个人网页特效-有前后日...
· 时间每过一秒,Radio就...
· 时钟显示在任意指定位...
· 带开关的Form时钟
· 记录几天后的日期
· 显示登陆时间
· 退出时显示访问时间
更多  
     
这个脚本将查询的结果显示在了文本框中
这个脚本将查询的结果显示在了文本框中
作者:佚名  来源:本站整理  名称:这个脚本将查询的结果显示在了文本框中 

减小字体 增大字体

       

[提示:你可先按照下面代码提示修改 上面部分代码,再按运行,此处看到的演示不完全正确]

此特效的详细完整代码如下:

要完成此效果把如下代码加入到<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://typhoon.500.to~JavaScript Fairyland|java javascript search html download cgi perl

dhtml games activex 下载 脚本^Typhoon Start!*http://www.1.com/~1.com|ActiveX ASP C/C++ CGI

Databases java javascript^1.com!*'>

</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>

[返回上一页] [打印这个脚本将查询的结果显示在了文本框中]
下一篇特效:较为简单的搜索器
     
| 关于本站 | 服务条款 | 友情连接 | 网站地图 | 联系方式 | 广告联系 |