关于静态业面的搜寻功能

mojialin100 2003-12-05 01:29:55
我想用web业面来实现一个界面来管理我的word资料,但是我需要把他刻成光盘,在任何机器上运行(win平台),可是我现在遇到一个难题,就是因为文件比较多,所以想写一个搜寻的功能,因为没有服务器和数据库的支持所以用asp php jsp来实现是不可能的,所以我想是不是可以用javaScript来实现,想了几个方法觉得较笨所以想请各位大虾指导指导,还有如果除开javaScript的话还有别的方法吗!如果那位有实现请给个代码好吗?时间比较急。。。
分数一定给!不给是piglet!
...全文
47 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
mojialin100 2003-12-07
  • 打赏
  • 举报
回复
谢谢各位,看来都是把数据存一个字符串,再写程序去对这个字符串处理,恩,看来只有这种方法了!
mojialin100 2003-12-06
  • 打赏
  • 举报
回复
aotianlong(傲天龙=初中没毕业) 你可以具体说说吗,最好有例子
ghlfllz 2003-12-06
  • 打赏
  • 举报
回复
sub sousuo(curl)
ghl=1
arrays2=split(strings2,",")
bbb=0
a=1
curlbak=curl
curl=replace(curl,"&",",")
curl=replace(curl,"|",",")
curl=replace(curl,"!",",")
theurlarray=split(curl,",")
for i=0 to ubound(theurlarray)
curlbak=replace(curlbak,theurlarray(i),",")
next
curlbak=right(curlbak,len(curlbak)-1)
thelabarray=split(curlbak,",")
if ubound(theurlarray)=0 then
for l=0 to ubound(arrays1)-1
if instr(arrays1(l),curl)<>0 then
arrays2(l)="1"
bbb=bbb+1
end if
next
else
for j=0 to ubound(theurlarray)-1
for i=0 to ubound(arrays1)-1
if thelabarray(j)="" then
exit for
end if
if thelabarray(j)="&" then
if instr(arrays1(i),theurlarray(j))<>0 and instr(arrays1(i),theurlarray(j+1))<>0 then
arrays2(i)="1"
bbb=bbb+1
end if
end if
if thelabarray(j)="|" then
if instr(arrays1(i),theurlarray(j))<>0 or instr(arrays1(i),theurlarray(j+1))<>0 then
arrays2(i)="1"
bbb=bbb+1
end if
end if
if thelabarray(j)="!" then
if ghl=1 then
for l=0 to ubound(arrays1)-1
if instr(arrays1(l),theurlarray(j))<>0 then
arrays2(l)="1"
bbb=bbb+1
end if
next
ghl=0
end if
if instr(arrays1(i),theurlarray(j+1))<>0 then
arrays2(i)="0"
bbb=bbb-1
end if
end if
next
next
end if
if bbb=0 then
div2.innerHTML="<font size=2 color=#000099 style='line-height:16px;'><b>【错误】:</b>对不起,数据库中没有找到任何符合条件的记录<b>!</b>请您参考系统帮助信息后重新搜索<b>!</b></font>"
div3.innerHTML="<blockquote><font size=2 color=#000099 style='line-height:20px;'><b>【错误帮助】:<br>1、</b>您所提交的表单数据中含有系统不认识的字符或字符串,如(、)等,因而导致找不到您所预<br>期的结果;<br><b>2、</b>系统允许进行单项查询和组合查询,进行组合查询时,请使用系统的标准逻辑符号,与逻辑<br>为:&、或逻辑为:|、非逻辑为:!;<br><b>3、</b>如果您所提交的关键字过于详细,您可能找不到您所想要的记录,建议您换用一个较为普通<br>的关键字进行查询;<br><b>4、</b>如果查询多次找不到您所想要的记录,这有可能是系统数据库中暂时没有包含您所查询的内<br>容,那么请您返回主页在产品菜单及相应目录中手动查询!</font></blockquote>"
exit sub
end if
if bbb<>0 then
strings4="<blockquote><font size=3 color=#000099>★ 下面是系统所找到的所有记录:</font><ul><font size=2 color=#000099 style='line-height:20px;'>"
for i=0 to ubound(arrays1)-1
if arrays2(i)="1" then
if i+1=4 or i+1=6 or i+1=9 or i+1=25 or i+1=26 or i+1=27 or i+1=28 or i+1=7then
strings4=strings4&"<b>"&a&"、</b><a href='"&arrays3(i)&"' class='astyle1'>"&arrays1(i)&"</a><br>"
a=a+1
else
strings4=strings4&"<b>"&a&"、</b><a href='../"&arrays3(i)&".html' class='astyle1'>"&arrays1(i)&"</a><br>"
a=a+1
end if
end if
next
end if
strings4=strings4&"</font></ul></blpckquot>"
div2.innerHTML="<font size=2 color=#000099 style='line-height:20px;'><b>【系统信息】:</b>系统找到"&a-1&"条记录,请选择转向!</font>"
div3.innerHTML=strings4
end sub
sub sousuo_onclick()
curl=""
if document.form1.textfield.value="" then
div1.innerHTML="<font size=2 color=#000099 style='line-height:16px;'>当前检索关键字:</font>"
div2.innerHTML="<font size=2 color=#000099 style='line-height:16px;'><b>【错误】:</b>对不起,您没有提交任何数据!请您重新搜索!</font>"
div3.innerHTML=""
exit sub
end if
curl=document.form1.textfield.value
durl=replace(curl,"&","、")
durl=replace(durl,"|","、")
durl=replace(durl,"!","、")
div1.innerHTML="<font size=2 color=#000099 style='line-height:16px;'>当前检索关键字:"&durl&"</font>"
call sousuo(curl)
end sub
sub helpdiv_onclick()
msgbox "查询的一般方法为:"&chr(13)&"  1、系统允许进行单项查询和组合查询,进行组合查询时,"&chr(13)&"请使用系统的标准逻辑符号,否则将因系统不认识该逻辑符号"&chr(13)&"(如‘(’、‘)’等)而找不到所需的结果!"&chr(13)&"  2、与逻辑为:&、或逻辑为:|、非逻辑为:!;"&chr(13)&"  3、如果查询多次找不到您所想要的记录,这有可能是系统"&chr(13)&"数据库中暂时没有包含您所查询的关键字,那么请您返回主页在"&chr(13)&"产品菜单及相应目录中手动查询!"&chr(13)&"  4、如果您没有提交任何数据,系统将自动返回表单的提交"&chr(13)&"者;"&chr(13)&"  5、如果您所提交的关键字过于详细,您可能找不到您所想"&chr(13)&"要的记录,建议您换用一个较为普通的关键字进行查询。",65,"搜索帮助"
end sub
ghlfllz 2003-12-06
  • 打赏
  • 举报
回复
strings3="index,index,index,http://www.dbell-ic.com.cn,index,http://www.dbell-ic.com.cn/english/,http://www.dbell-ic.com.cn,index,http://www.dbell-ic.com.cn/english/,company/company,company/company,company/cintroduce,company/formframe,company/managearea,company/investdirect,company/devolop,company/customer,company/job,company/job,company/job,company/relation,company/relation,webdata/sousuo,webdata/sousuo,http://www.photo-home.com/book/book.asp?user=dbell,http://www.photo-home.com/book/book.asp?user=dbell,http://www.photo-home.com/book/book.asp?user=dbell,http://www.photo-home.com/book/book.asp?user=dbell,product/router,product/electronpolice,product/dbellherald,product/dbellstroll,product/dbellidea,product/dbellspark,product/dbelltillage,product/dbellexplore,product/multivoice,product/netcamera,product/twistimg,product/mpegimgzip,product/multichannel,product/commandsafe,product/dbellexplore,product/shuzianfang,product/shuzianfang,product/dbellexplore,product/dbellexplore,product/dbellherald,product/dbellherald,product/dbellstroll,product/dbellstroll,product/dbellherald,product/dbellherald,product/dbellexplore,product/dbellidea,product/dbellspark,product/dbellspark,product/dbelltillage,product/dbellexplore,product/productintro,product/productintro,product/productparam,product/productparam,product/productparam,product/commandsafe,product/broadband,product/datatv,product/ipphone,product/tvtopbox,product/broadband,product/1632img,product/imgassay,product/tvstunt,product/superdisplaay,product/broadband,product/icdesign,product/icdesign,product/carandele,product/carandele,product/instrument,product/instrument,product/instrument,product/instrument,product/instrument,product/instrument,product/instrument,product/instrument,product/instrument,product/icdesign,product/computerias96g,product/computerias96g,product/computerias96g,product/computerstd,product/computerstd,instructor/instructor,instructor/instructor,instructor/instructor,instructor/instructor,theother/tabloid,theother/tabloid,theother/tabloid1,theother/tabloid2,theother/tabloid3,theother/tabloid4,theother/tabloid5,theother/tabloid6,theother/tabloid7,theother/tabloid8,"
arrays1=split(strings1,",")
arrays2=split(strings2,",")
arrays3=split(strings3,",")
call jiance()
sub jiance()
if right(aurl,1)="=" or instr(1,aurl,"?")=0 or instr(1,aurl,"=")=0 then
for i=1 to len(aurl)
if left(right(aurl,i),1)="/" then
exit for
else
eurl=right(aurl,i)
end if
next
if eurl="sousuo.html" then
div1.innerHTML="<font size=2 color=#000099 style='line-height:16px;'>当前检索关键字:</font>"
div2.innerHTML="<font size=2 color=#000099 style='line-height:20px;'><b>【系统信息】:</b>您没有提交任何数据!请您搜索!</font>"
div3.innerHTML=""
else
div1.innerHTML="<font size=2 color=#000099 style='line-height:16px;'>当前检索关键字:</font>"
div2.innerHTML="<font size=2 color=#000099 style='line-height:16px;'><b>【错误】:</b>对不起,您提交了无效的检测索数据!请您重新搜索!</font>"
div3.innerHTML=""
end if
else
for i=1 to len(aurl)
if left(right(aurl,i),1)="?" then
exit for
else
burl=right(aurl,i)
end if
next
for i=1 to len(burl)
if left(right(burl,i),1)="=" then
exit for
else
curl=right(burl,i)
end if
next
durl=replace(curl,"&","、")
durl=replace(durl,"|","、")
durl=replace(durl,"!","、")
div1.innerHTML="<font size=2 color=#000099 style='line-height:16px;'>当前检索关键字:"&durl&"</font>"
call sousuo(curl)
end if
end sub
ghlfllz 2003-12-06
  • 打赏
  • 举报
回复
我以前写过一个,是用vbscript写的,功能比较强大,支持模糊查询,可以使用多个与或非号

public burl,aurl
aurl=document.location
public strings1,strings2,strings3,strings4
public arrays1,arrays2,arrays3
strings1="得贝公司,北京得贝电子有限公司,北京得贝电子科技有限公司,网站主页,中文主页,英文主页,网站首页,中文首页,英文首页,公司介绍,公司简介,公司文化,组织结构,经营范围,研究方向,发展规划,合作伙伴,招聘信息,人才招聘,诚聘英才,联系方法,联系地址,搜索引擎,站内搜索,网站留言系统,留言本,留言板,留言簿,路由器,电子警察,得贝使者,得贝漫步者,得贝思想者,得贝倡导者,得贝耕耘者,得贝探索者,多通道声卡,网络型摄像机,双绞线图像传输机,MPEG图像压缩板,多通道高压缩比录音板,通讯安防,专业保镖,安防监控,数字安防系统,单通道数字录像机,实时智能数字录像机,多通道实时数码录像系统,多通道数字录像机,网络视音频服务器,网络视频音频服务器,多通道监控系统,多通道监控主机,单通道监控主机,多画面处理器,视/音频切换矩阵,视频音频切换矩阵,远程图象传输机,实时智能数字录像机,产品介绍,产品简介,产品导购,产品信息,性能参数,专用多媒体1(通讯安防),专用多媒体2(宽带广播),数字电视,IP电话机,电视机机顶盒,DVB有线电视系统,16/32位图形图像板,智能图像分析压缩卡,专业广播电视特技卡,超大屏幕显示控制器,宽带广播,集成电路设计,IC设计,汽车电子,车载多媒体中心,仪器仪表,家用智能能量计量表,电表,电力计费表,电能计费表,水能计费表,水力计费表,天然气计费表,天然气能量计费表,集成电路,工业计算机,专用计算机,ISA96工业计算机,STD工业计算机,CTI,技术支持,系统帮助,在线支持,在线帮助,文摘报道,DVB的发展机遇,MPEG的产生,MPEG-1简介,MPEG-2简介,MPEG-4简介,MPEG-7简介,MPEG-2标准,MPEG和其它标准,电子信息产业分析,"
strings2="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
colee 2003-12-06
  • 打赏
  • 举报
回复
<script language="JavaScript">
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window; // window to search.
var n = 0;
function searchInPage(str) {
var txt, i, found;
if (str == "") return false;
if (NS4)
{ if (!win.find(str))
while(win.find(str, false, true)) n++;
else
n++;
if (n == 0) alert("Not found."); }

if (IE4)
{ txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit"); }

if (found)
{
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else
{
if (n > 0)
{
n = 0;
searchInPage(str);
}
else
alert("Not found.");
}
}
return false;
}
</script>

<input name="recordKey" type="text" id="recordKey" style="width:50%;background-color:#CCCCFF"" value="输入关键字" onFocus="this.select()" onChange="n = 0;"/>
<input name="btnSearch" type="button" id="btnSearch" style="width:70px;height:20px;cursor:hand;" value="本页查找" onClick="return searchInPage(document.all.recordKey.value);"/>
nik_Amis 2003-12-06
  • 打赏
  • 举报
回复
up
aotianlong 2003-12-05
  • 打赏
  • 举报
回复
最简单的方法
<isindex>
html自己带的搜索标签
swich 2003-12-05
  • 打赏
  • 举报
回复
http://dx168.nease.net/webtexiao/js/search/search001.htm

这个很不错
AgathaZ 2003-12-05
  • 打赏
  • 举报
回复
http://www.cn76.com/js/

进这个网站吧,里面有几个站内搜索的脚本

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧