一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp 防止提交html代码程序与实例教程

时间:2010-04-16 编辑:简简单单 来源:一聚教程网



 
 


   
 


 


   
 





<%
if request("action") = "submit" then
 ubbHtml = nohtml( request.Form("textarea")
 ubbTitle = nohtml( request.Form("textfield")
 if ubbHtml ="" then
  '提示
 else
  '保存数据
 end if
else
 response.Write("未提交内容")
end if
function nohtml(byval str)
 if isnull(str) or trim(str)="" then
  nohtml=""
  exit function
 end if
    dim re
    Set re=new RegExp
    re.IgnoreCase =true
    re.Global=True
    re.Pattern="(<.[^<]*>)"
    str=re.replace(str," ")
    re.Pattern="()"
    str=re.replace(str," ")
    set re=nothing
 str=replace(str,chr(34),"")
 str=replace(str,"'","")
    nohtml=str
end function
%>

热门栏目