asp去除html 保留<br><p>切取字符串长度
<% function LoseHtml(ContentStr) Dim ClsTempLoseStr,RegEx ClsTempLoseStr = Cstr(ContentStr) Set RegEx = New RegExp RegEx.Pattern = "<\/*[^<>]*>" RegEx.IgnoreCase = True RegEx.Global = True ClsTempLoseStr = RegEx.Replace(ClsTempLoseStr,"") Set RegEx = Nothing LoseHtml = ClsTempLoseStr End function %> <% function cutstr(tempstr,tempwid) if len(tempstr)>tempwid then cutstr=left(tempstr,tempwid)&"..." else cutstr=tempstr end if end function %>
<%=cutstr(LoseHtml(rs("content")),200)%>
|