日期:2014-05-17  浏览次数:20911 次

一个关于关键字查找的问题 急!!!
dim   rb,i,com
rb=split( "关键字一|关键字二|关键字三|关键字四|工厂 ", "| ")for   i=lbound(rb)   to   ubound(rb)
com=instr(Comments,rb(i))
next
if   com   >   0   then
view=0
else
view=1
end   if

com=instr(Comments,rb(i))   这一句我要一一比较关键词
可现在只能比较最后面的一个词
请问   应该怎么修改

/*asp   VBScript   */

请大家赐教!!!

------解决方案--------------------
dim rb,i,com,view
rb=split( "关键字一|关键字二|关键字三|关键字四|工厂 ", "| ")for i=lbound(rb) to ubound(rb)
com=instr(Comments,rb(i))
if com > 0 then
view=0
else
view=1
end if
next

呵呵,如此简单,LZ太不细心了吧

------解决方案--------------------
for i=lbound(rb) to ubound(rb)
com=instr(Comments,rb(i))
next


这个循环里的com的值总被最后一个值复盖,最后的结果当然只是最后一个关键字的位置了
------解决方案--------------------
dim rb,i,com
view=1
rb=split( "关键字一|关键字二|关键字三|关键字四|工厂 ", "| ")
for i=lbound(rb) to ubound(rb)
com=instr(Comments,rb(i))
if com > 0 then
view=0
end if
next

------解决方案--------------------
dim rb,i,com
rb=split( "关键字一|关键字二|关键字三|关键字四|工厂 ", "| ")
for i=lbound(rb) to ubound(rb)
com=instr(Comments,rb(i))
if com > 0 then
view=0
else
view=1
end if
response.write "第 "&i& "关键字= "&view& " <br> "
next

------解决方案--------------------
发现解决了,接点分
------解决方案--------------------
next放错地方了