当前位置: 首页 > 图文教程 > 网络编程 > ASP > 自动去除字符中含有html代码的几个ASP函数

ASP
出现404页面错误的自动发送邮件的代码
ASP视频教程:建立显示已经添加的新闻页面
ASP视频教程:使用Eweb编辑器丰富新闻内容的格式
ASP视频教程:建立修改新闻页面
ASP视频教程:制作删除新闻的功能
ASP视频教程:建立产品类别表和添加类别页面
ASP视频教程:建立管理产品的页面
ASP视频教程:制作其它栏目管理页面
ASP实例教程:隐藏下载地址和防盗
ASP教程:虚拟目录下不能上传图片
ASP视频教程:制作网站前台顶部导航页面
ASP视频教程:制作前台导航菜单
ASP视频教程:对前台导航菜单进行调整美化
ASP视频教程:制作新闻中心显示页面
ASP视频教程:制作新闻详细内容显示页面
ASP视频教程:制作前台产品显示页面(按产品类别显示)
ASP视频教程:制作前台产品显示页面(横向重复显示图片)
ASP视频教程:制作在线订购页面
ASP视频教程:制作关于我们和联系我们页面
ASP视频教程:后台功能的一些完善

自动去除字符中含有html代码的几个ASP函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 71 ::
收藏到网摘: n/a

以下为引用的内容:
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function

以下为引用的内容:
Public Function Replacehtml(Textstr)
Dim Str,re
Str=Textstr
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<(.[^>]*)>"
Str=re.Replace(Str, "")
Set Re=Nothing
Replacehtml=Str
End Function

以下为引用的内容:
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
set re=nothing
end function

以下为引用的内容:
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function