欢迎光临
我们一直在努力

一个功能更强大的函数,也是用正则表达式写的

建站超值云服务器,限时71元/月

<%

option explicit

function striphtml(strtext)

dim arysplit,i,j, stroutput

arysplit=split(strtext,"<")

if len(arysplit(0))>0 then j=1 else j=0

for i=j to ubound(arysplit)

if instr(arysplit(i),">") then

arysplit(i)=mid(arysplit(i),instr(arysplit(i),">")+1)

else

arysplit(i)="<" & arysplit(i)

end if

next

stroutput = join(arysplit, "")

stroutput = mid(stroutput, 2-j)

stroutput = replace(stroutput,">",">")

stroutput = replace(stroutput,"<","<")

striphtml = stroutput

end function

%>

<form method="post" id=form1 name=form1>

<b>enter an html string:</b><br>

<textarea name="txthtml" cols="50" rows="8" wrap="virtual"><%=request("txthtml")%></textarea>

<p>

<input type="submit" value="strip html tags!" id=submit1 name=submit1>

</form>

<% if len(request("txthtml")) > 0 then %>

<p><hr><p>

<b><u>view of string <i>with no</i> html stripping:</u></b><br>

<xmp>

<%=request("txthtml")%>

</xmp><p>

<b><u>view of string <i>with</i> html stripping:</u></b><br>

<pre>

<%=striphtml(request("txthtml"))%>

</pre>

<% end if %>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 一个功能更强大的函数,也是用正则表达式写的
分享到: 更多 (0)