ASP高亮关键字

来源:互联网 发布:超星网络课程答案 编辑:程序博客网 时间:2024/05/04 05:07
  1. <%      
  2. public function keywordlight(l1,l2)      
  3.      dim bads,I1,I2,I3,i      
  4.      if len(l1)>0 and len(l2)>0 then      
  5.          I1=l1      
  6.          I2=split(l2,",")      
  7.              set I3=new regexp      
  8.                  I3.global=true      
  9.                  I3.ignorecase=true      
  10.                  for i=0 to ubound(I2)      
  11.                      if len(trim(I2(i)))>0 then      
  12.                          I3.pattern="("&I2(i)")"     
  13.                          I1=I3.replace(I1,"<font color=red>$1</font>")      
  14.                      end if      
  15.                  next      
  16.                  keywordlight=I1      
  17.              set I3=nothing      
  18.      end if      
  19. end function      
  20.      
  21. Response.Write keywordlight("蓝雨设计","雨,计")      
  22. %>  
原创粉丝点击