<%
'过滤字符串Str中的HTML代码
Public Function FilterHtml(Str)
If Trim(Str) = "" Or IsNull(Str) Then
FilterHtml=""
Else
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, Chr(32), " ")
Str = Replace(Str ,Chr(9), " ")
Str = Replace(Str, Chr(34), """)
Str = Replace(Str, Chr(39), "'")
Str = Replace(Str, Chr(13), "")
Str = Replace(Str, Chr(10) & Chr(10), "</p><p>")
Str = Replace(Str, Chr(10), "<br> ")
FilterHtml = Str
End If
End Function
%>
<form name="form1" method="post" action="">
输入字符串:
<input name="text" type="text" id="text" >
<input type="submit" name="Submit" value="提交">
</form>
<%
Dim X
X=Request.Form("text")
If X<>"" Then
%>
<p>输入的字符串为:<%=X%></p>
<p>过滤HTML代码后的字符串为:<%=FilterHtml(X)%></p>
<%
End If
%>
'过滤字符串Str中的HTML代码
Public Function FilterHtml(Str)
If Trim(Str) = "" Or IsNull(Str) Then
FilterHtml=""
Else
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, Chr(32), " ")
Str = Replace(Str ,Chr(9), " ")
Str = Replace(Str, Chr(34), """)
Str = Replace(Str, Chr(39), "'")
Str = Replace(Str, Chr(13), "")
Str = Replace(Str, Chr(10) & Chr(10), "</p><p>")
Str = Replace(Str, Chr(10), "<br> ")
FilterHtml = Str
End If
End Function
%>
<form name="form1" method="post" action="">
输入字符串:
<input name="text" type="text" id="text" >
<input type="submit" name="Submit" value="提交">
</form>
<%
Dim X
X=Request.Form("text")
If X<>"" Then
%>
<p>输入的字符串为:<%=X%></p>
<p>过滤HTML代码后的字符串为:<%=FilterHtml(X)%></p>
<%
End If
%>
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}