一个关于html标签的问题.

showgu 2005-11-02 10:22:23
我现在有这么一个问题,有个新闻,本身包含html信息,现在想在首页调用其中一部分内容,但是不想吧html标签带进去,我尝试了用字符串函数,但是不是很成功.
Function tiqu(alltmp)
length=len(alltmp)
if alltmp<>"" then
tag=Instr(alltmp,"<")
response.Write(tag)
txt1=left(alltmp,tag-1)
tag1=Instr(alltmp,">")
alltmp=right(alltmp,length-tag1)
response.Write(alltmp)
end if
end Function
单个似乎可以,但是本人编程水平有限,想把里面的html标签全部去掉.尝试过程写循环一直出错,请大家指教.

...全文
105 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ar7_top 2005-11-03
  • 打赏
  • 举报
回复
可以用iframe么?
我觉得用iframe的话什么都不用操作,应该会更简单
yingle2000 2005-11-02
  • 打赏
  • 举报
回复
Function TagErase(html)
Dim regex
Set regex = Server.CreateObject("VBScript.RegExp")
regex.Pattern = "<(.|[" & vbCrLf & "])*?>"
regex.Global = True
TagErase = regex.Replace(html, "")
End Function

Response.Write TagErase("<html>test</html>")
hxyman 2005-11-02
  • 打赏
  • 举报
回复
<%
str="afsdfasd<aa>fasdf<html>asdf<br><b>sdfsdaf"
Set re = New RegExp
re.Pattern = "\<[^>]+()\>"
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
str=re.replace(str,"$1")
response.write "<textarea>"&str&"</textarea>"
%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧