一个用javascript做的检索

//这是我们做学生数据检索用的,其内容可达几千个学生,包含3个htm文档

//jiansuo_1.htm
<HTML>
<HEAD>
<TITLE>
学生档案快速搜索
</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of script
var maxIndex = 10 //增加人数只要修改它就行了
var title = new Array()
//具体内容
title[1]="970382 周亚镯 女 团员 汉 长安 "
title[2]="970383 钟丽 女 团员 汉 湖北 "
title[3]="970384 张粉艳 女 团员 汉 云南 "
title[4]="970385 张静 女 团员 汉 蓝田 "
title[5]="970386 曾迎霞 女 团员 汉 湖南 "
title[6]="970387 邢国平 女 团员 汉 河南 "
title[7]="970388 夏培培 女 团员 汉 江苏 "
title[8]="970389 孙志芳 女 团员 汉 山西 "
title[9]="970390 庞旭瑞 女 团员 汉 山西 "
title[10]="970391 刘艳 女 团员 汉 山东 "
function processor(form)
{  var i,j=0
  var found = false
  var result = "<HTML><HEAD><TITLE>经济管理学院学生档案快速搜索</TITLE><HEAD>"
  var result1 = "<HTML><HEAD><TITLE>经济管理学院学生档案快速搜索</TITLE><HEAD>" 
  var searchStr = form.keyword.value.toLowerCase()
  
  if (searchStr == "")
  {  return(false)
  }
  result1 += "<BODY bgcolor='#FFFFFF' text='#000000' vlink='#CC0033' "
  result1 += "link='#3300CC' alink='#660033'>"
  result1 += "<BASEFONT SIZE='2'>"   
  result += "<BODY bgcolor='#FFFFFF' text='#000000' vlink='#CC0033' "
  result += "link='#3300CC' alink='#660033'>"
  result += "<BASEFONT SIZE='2'>"
  result += "<table cellspacing=0 cellpadding=0 border=0><tr><td width=230 valign=top></td><td width=420>"
 
  
  for (i = 1; i <= maxIndex; i++)
  {  if (title[i].toLowerCase().indexOf(searchStr) != -1)
    {  result +="<LI>"
      result += title[i]
      result +="</LI>"
      found = true
      j++
    }
  }
  result += "</td><td valign=top width=150></td></tr></table>"
  if (!found)
  {  result += "对不起,没有您要找的同学."
    result += searchStr
    result += "."
  }
  result += "</BODY></HTML>"

  result1 += "<body><table height=20 cellspacing=0 cellpadding=0 border=0 bgcolor=#3366cc><tr><td width=250><font color=#FFFFFF size=1.5>您输入的检索词是:"+form.keyword.value.toLowerCase()+"</tont></td><td width=350 align=left><font color=#FFFFFF size=1.5>&nbsp&nbsp&nbsp学号&nbsp&nbsp&nbsp姓名&nbsp&nbsp性别&nbsp政治面貌&nbsp民族&nbsp籍贯</tont></td><td width=200><font color=#FFFFFF size=1.5>共有"+j+"个检索结果</tont></td></tr></table></body></html>"

  
  parent.bottom.document.open()
  parent.bottom.document.write(result)
  parent.bottom.document.close()
  parent.middle.document.open()
  parent.middle.document.write(result1)
  parent.middle.document.close()
  return(false)
}

// End of script -->
</SCRIPT>
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000" vlink="#CC0033" link="#3300CC" alink="#660033">
<P align="center">
<FORM ONSUBMIT="return false">
<font color=#ff0000><b>请输入学生学号或姓名:</b> </font><INPUT TYPE="text" NAME="keyword" SIZE="30">
<INPUT TYPE="button" VALUE="Search" ONCLICK="processor(this.form)">
</FORM>
</p>
</BODY>
</HTML>


//jiansuo_2.htm
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>

//jiansuo_main.htm
<HTML>
<HEAD>
<TITLE>学生档案快速检索</TITLE>
</HEAD>
<FRAMESET ROWS="12%,10%,78%" border=0 frameborder="NO">

<NOFRAMES>
<P>
You need a browser that supports frame.
<P>
We recommend using either <A HREF="http://www.netscape.com">Netscape Navigator</A> or
<A HREF="http://www.microsoft.com">Microsoft Internet Explorer version 3.0 or above.
</NOFRAMES>

<FRAME SRC="jiansuo_1.htm" NAME="top">
<FRAME SRC="" NAME="middle" scrolling="NO">
<FRAME SRC="jiansuo_2.htm" NAME="bottom">

</FRAMESET>
</HTML>

//把三个文件存在同一目录系阿,最后打开jiansuo_main.htm就可以了。
//外表跟其它搜索没什么分别哦