首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

asp从编辑中过滤和显示图片分别如何写

2012-08-13 
asp从编辑中过滤和显示图片分别怎么写asp从编辑中过滤和显示图片分别怎么写,请高人请教下。(通过后编辑器加

asp从编辑中过滤和显示图片分别怎么写
asp从编辑中过滤和显示图片分别怎么写,请高人请教下。(通过后编辑器加的文章,中间带有图,想单独显示文字或图)

[解决办法]
这个是用正则把图片摘出来,其余的就是内容了

VBScript code
      content=rs("content")'数据库的内容字段      Set re = New RegExp      re.Pattern = "<img(.+?)src=""*([^\s]+?)""*(\s|>)"      re.Global = True      re.IgnoreCase = True      Set Contents = re.Execute(content)      For Each Match in Contents ' 遍历匹配集合。          Response.Write "<img src='"&Images & Match.SubMatches(1)&"' />"      Next
[解决办法]
VBScript code
content=rs("content")'数据库的内容字段      Set re = New RegExp      re.Pattern = "<img(.+?)src=""*([^\s]+?)""*(\s|>)"      re.Global = True      re.IgnoreCase = True      Set Contents = re.Execute(content)      For Each Match in Contents ' 遍历匹配集合。                   Response.Write "<img src='"&Images & Match.SubMatches(1)&"' />"      Next       content=re.replace(content, "") '把图片过滤掉,剩下的就是文字了,上面那个匹配的就都是图片了,自己可以运行测试就输出结果看下就明白了 

热点排行