<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Response.CodePage=65001%>
<% Response.Charset="UTF-8" %>
<%
dim content_text,searchword_text
'content是内容,searchword是要搜索的文字
sub search(content,searchword)
if InStr(content,searchword) > 0 then
Response.Write("找到")
Else
Response.Write("没有找到")
End if
end sub
耐心点啊,偶起码有一年没碰ASP了啊,[Quote=引用 61 楼 puber 的回复:]
引用 59 楼 pdysuny 的回复:
下面代码解决了这个问题,加分再解决另外一个问题,就是如何统计出这列中对的个数??
for j=1 to len(s2)
if InStr(hs1,mid(s2,j,1))>0 then
Response.Write("对")
Else
Response.Write("错")
End if
next
有一大串是对的,但这样统计出来response.write x,结果=2,只有2个,为何呢 [Quote=引用 60 楼 xiaojielanbaihe 的回复:]
dim x
x=0
for j=1 to len(s2)
if InStr(hs1,mid(s2,j,1))>0 then
Response.Write("对")
x=x+1
Else
Response.Write("错")
End if
next
response.write x
[/Quote]
[Quote=引用 59 楼 pdysuny 的回复:]
下面代码解决了这个问题,加分再解决另外一个问题,就是如何统计出这列中对的个数??
for j=1 to len(s2)
if InStr(hs1,mid(s2,j,1))>0 then
Response.Write("对")
Else
Response.Write("错")
End if
next
[/Quote]
function searchtext(hs1,s2)
dim j
flag=false
for j=1 to len(s2)
if instr(hs1,mid(s2,j,1))>0 then
flag=true
exit for
end if
next
if flag=true then
response.Write("包含")
else
response.Write("不包含")
end if
end function