• ----:)欢迎访问源码网(:----
    • 首页
    • 博客
    • 学院
    • 下载
    • 论坛
    • 影视
    • 发布源码
    • RSS
    • ITPig
    • 笑话网
    • 百家姓
    • 繁體中文

源码网 - 中国第一源码门户
选择镜像:网通镜像 - 电信主站
  • 首 页
  • 新闻动态
  • 网站运营
  • 网页制作
  • WEB开发
  • 编程开发
  • 图像媒体
  • 操作系统
  • 数据库
  • 服务器
热门搜索 优化 SEO 故事 cms IIS7 MySQL 个人 AdSense 主题推广 | 文章搜索: 高级搜索
会员登录/控制面版您的位置: 学院首页 >> WEB开发 >> ASP开发 >> ASP技巧 >> 详细内容
 

推荐文章

 
 

热点文章

  • ASP采集教程基础篇
  • ASP+JS三级联动下拉菜单[调用数据库数据]
  • 根据IP地址自动判断转向分站的代码
  • 如何使ASP程序暂停指定的时间后再继续执行
  • 防止网上重复投票的方法
  • 精华ASP代码
  • WEB打印大全
  • 同一个空间不同的域名实现访问不同的文件夹
  • 小偷程序原理和简单示例
  • Asp限制IP访问
  • 实现页面重定向
  • ASP自动解压RAR文件
 
 

相关文章

  • 检测浏览器是否支持有Flash2.0以上或有Flash插件
  • 用HTML META标签和ASP来作定时迟时信息
  • 怎样计算折扣
  • 计算文件下载时间
  • 动态输入框的三个函数
  • 检测表单输入EMAIL的合法性
  • 多域名同一空间的处理实例
  • Asp限制IP访问
  • 检测整数和长整数的函数
  • 如何使ASP程序暂停指定的时间后再继续执行
  • 使用ASP和Word进行服务器端拼写检查
  • 用ASP在ACCESS中插入图片怎么表示?
 
 

百度搜索

 
 

实现搜索结果的关键词变色标注的程序

  • 阅览次数:
  • 文章来源: 网海之贝
  • 原文作者: 佚名
  • 整理日期: 2006-10-03
  • 发表评论
  • 字体大小:
  • 小
  • 中
  • 大

<%
' 以前写全文检索程序的时候写的.
' 原创 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)  ' 设置模式。
    regEx.IgnoreCase = True     ' 设置是否区分字符大小写。
    regEx.Global = True     ' 设置全局可用性。
    Set Matches = regEx.Execute(str)  ' 执行搜索。  
    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
  
%>

上一篇:Asp深度揭密
下一篇:构建支持Master/Slave读写分离的数据库操作类
  • 网友评论:
  • 查看所有评论
  • 我要发表评论
您的网名:
留言主题:
你要发表的内容:

 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 发布软件 | 帮助中心 | 源码论坛

Copyright © 2005-2007 CodePub.Com  程序支持:木翼  滇ICP备05005971号