ASP 去掉 HTML 代码
<%setrs1=server.CreateObject("adodb.recordset")rs1.open"select*fromsk_ArticlewhereCla...
<%set rs1=server.CreateObject("adodb.recordset")
rs1.open"select * from sk_Article where ClassID='191' and ChannelID=1 order by ArticleID desc",conn,1,1
if rs1.eof then
response.Write("暂时没有新闻!")
else
i=0
do while not rs1.eof%>
<%=left(rs1("Content")),50)%>
<%i=i+1
if i>=1 then exit do
rs1.movenext
loop
end if
rs1.close
set rs1=nothing%>
ASP 去掉 HTML 代码 <%=left(rs1("Content")),50)%> 这里,麻烦大虾说说,谢谢. 展开
rs1.open"select * from sk_Article where ClassID='191' and ChannelID=1 order by ArticleID desc",conn,1,1
if rs1.eof then
response.Write("暂时没有新闻!")
else
i=0
do while not rs1.eof%>
<%=left(rs1("Content")),50)%>
<%i=i+1
if i>=1 then exit do
rs1.movenext
loop
end if
rs1.close
set rs1=nothing%>
ASP 去掉 HTML 代码 <%=left(rs1("Content")),50)%> 这里,麻烦大虾说说,谢谢. 展开
2个回答
展开全部
如果只是去掉html代码,则核团使用御氏碰下面函数镇谈
<%=left(nohtml(rs1("Content")),50)%>
Function nohtml(str)
Dim re
Set re=new RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern="(\<.*?\>)"
str=re.replace(str,"")
re.Pattern="(\<\/.*?\>)"
str=re.replace(str,"")
nohtml=str
End Function
<%=left(nohtml(rs1("Content")),50)%>
Function nohtml(str)
Dim re
Set re=new RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern="(\<.*?\>)"
str=re.replace(str,"")
re.Pattern="(\<\/.*?\>)"
str=re.replace(str,"")
nohtml=str
End Function
追问
Microsoft VBScript 编译器错误错误 '800a03ea'语法错误/index.asp,行 151Function nohtml(str)
不行哦,麻烦你全部贴上来可以吗,谢谢你了.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询