首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

一个多关键字查询,查询关键字亮红显示的有关问题

2012-04-02 
一个多关键字查询,查询关键字亮红显示的问题做了个多关键字查询,想实现如百度那样查询的关键子在结果中红

一个多关键字查询,查询关键字亮红显示的问题
做了个多关键字查询,想实现如百度那样查询的关键子在结果中红色显示的效果,我是这样写的
searchdatatmp=split(wd, "   ")  
max=ubound(searchdatatmp)

str=rs( "title ")
if   max=0   then
str1=searchdatatmp(i)
invert=replace(str,str1, " <font   color=ff0000> "&str1& " </font> ")
response.Write(invert)
else
for   i=0   to   max  
invert=replace(str,str1, " <font   color=ff0000> "&str1& " </font> ")
response.Write(invert)
end   if
exit   for  
next
end   if

现在一个关键字没问题,但多个关键字效果就出不来,新闻标题成了重复显示了

[解决办法]
searchdatatmp=split(wd, " ")
max=ubound(searchdatatmp)
str=rs( "title ")
for i=0 to max
str=replace(str,searchdatatmp(i), " <font color=ff0000> "&searchdatatmp(i)& " </font> ")
next
response.Write(str)

热点排行