成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

當前位置:首頁>>開發(fā)編程>>ASP>>新聞內(nèi)容
實現(xiàn)搜索結(jié)果的關(guān)鍵詞變色標注的程序
作者:飛鳥 發(fā)布時間:2003-10-8 2:48:08 文章來源:
<%
' 以前寫全文檢索程序的時候?qū)懙?
' 原創(chuàng) by 飛鳥@dev-club.com
' Email: flybird@dev-club.com
' ie5.5 腳本引擎 required

  dim patern
  dim found
  
  dim str
  dim result
  
  patern="(a)|(b)"
  str=" A dog fall in love with a cat. Can you believe?"
  result=""  
  call getMatchText(str,result,false)
  Response.Write result

  sub getMatchText(byref str,byref result,isNeedTrunc)
    'on error resume next
    Dim regEx, Match, Matches
    dim tStr
    Set regEx = New RegExp     ' 建立正則表達式。    
    regEx.Pattern = (patern)  ' 設(shè)置模式。
    regEx.IgnoreCase = True     ' 設(shè)置是否區(qū)分字符大小寫。
    regEx.Global = True     ' 設(shè)置全局可用性。
    Set Matches = regEx.Execute(str)  ' 執(zhí)行搜索。  
    if err.number<>0 then
      response.write "錯誤1:" & err.description
      err.clear
      exit sub
    end if
    if matches.count <>0 then
      dim startIndex      
      dim myMatchValue
      startIndex=1
      for each match in matches
        if (instr(str,match.value)>0) then
          if instr(str,match.value)-50 >0 then
            startIndex=instr(str,match.value)-50
          else
            startIndex=1
          end if
          myMatchValue=match.value
          exit for
        end if
      next
      if isNeedTrunc then
        result= (mid(str,startIndex,strLength(myMatchValue)+100))
      else
        result= (str)  
      end if
      for each match in matches
        if not(instr(result,"<font color=red>" & match.value & "</font>")>0) then
          result=replace(result,match.value,"<font color=red>" & match.value & "</font>" )
        end if
      next
      found=true
    else
      found=false
    end if  
    set regEx=nothing
  end sub
  
%>

最新更新
·數(shù)據(jù)庫被掛馬的ASP處理方法
·ASP快速獲取遠程文件大小的方
·用ASP屏蔽迅雷和旋風下載工具
·解決ASP中傳送中文參數(shù)亂碼的
·ASP+AJAX做類似Google的搜索
·ASP的一個非常棒的Debug類(
·ASP中常用的服務(wù)器檢測源代碼
·優(yōu)化ASP中執(zhí)行SQL效率的五個
·ASP種msxml3.dll 800c0005錯
·掛QQ的ASP版本網(wǎng)頁源代碼
相關(guān)信息
·ASP智能搜索的實現(xiàn)
畫心
愚愛
偏愛
火苗
白狐
畫沙
犯錯
歌曲
傳奇
稻香
小酒窩
獅子座
小情歌
全是愛
棉花糖
海豚音
我相信
甩蔥歌
這叫愛
shero
走天涯
琉璃月
Nobody
我愛他
套馬桿
愛是你我
最后一次
少女時代
灰色頭像
斷橋殘雪
美了美了
狼的誘惑
我很快樂
星月神話
心痛2009
愛丫愛丫
半城煙沙
旗開得勝
郎的誘惑
愛情買賣
2010等你來
我叫小沈陽
i miss you
姑娘我愛你
我們都一樣
其實很寂寞
我愛雨夜花
變心的玫瑰
犀利哥之歌
你是我的眼
你是我的OK繃
貝多芬的悲傷
哥只是個傳說
丟了幸福的豬
找個人來愛我
要嫁就嫁灰太狼
如果這就是愛情
我們沒有在一起
寂寞在唱什么歌
斯琴高麗的傷心
別在我離開之前離開
不是因為寂寞才想你
愛上你等于愛上了錯
在心里從此永遠有個你
一個人的寂寞兩個人的錯
主站蜘蛛池模板: 桦甸市| 农安县| 阿巴嘎旗| 禹州市| 巴塘县| 潢川县| 海口市| 柏乡县| 游戏| 玉田县| 仪征市| 通化市| 新河县| 尼玛县| 宾阳县| 中超| 六安市| 内乡县| 巧家县| 偃师市| 陇川县| 乾安县| 宿州市| 兴国县| 余庆县| 海口市| 萨嘎县| 汉阴县| 惠东县| 富源县| 扎鲁特旗| 边坝县| 安陆市| 津南区| 泗洪县| 博湖县| 株洲县| 文成县| 余干县| 韩城市| 凌海市|