http://www.cn76.com/js/进这个网站吧,里面有几个站内搜索的脚本

解决方案 »

  1.   

    http://dx168.nease.net/webtexiao/js/search/search001.htm这个很不错
      

  2.   

    最简单的方法
    <isindex>
    html自己带的搜索标签
      

  3.   

    aotianlong(傲天龙=初中没毕业) 你可以具体说说吗,最好有例子
      

  4.   

    <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);"/> 
      

  5.   

    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
      

  6.   

    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