求段过滤非法字符的代码

liushengan 2004-10-08 09:00:51
如果输入框内出现“博客”这两个字则自动将其转换为Blog。
...全文
190 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
香椿炒鸡蛋 2004-10-09
  • 打赏
  • 举报
回复
建议用正则表达式 过滤非法字符
777dragon 2004-10-08
  • 打赏
  • 举报
回复

就是Ya! (-___-#)!!! 狼来啦~~~~

cnwhitewolf 2004-10-08
  • 打赏
  • 举报
回复
strText=replace(strText,"博客CSDN","blog")
mind_1220 2004-10-08
  • 打赏
  • 举报
回复
<%
strText = "博客CSDN"
str1="博客"
str2="blog"
strText = Replace(strText,str1,str2)
response.write strText '写出来看看就明白了。
%>
liushengan 2004-10-08
  • 打赏
  • 举报
回复
看不明白
777dragon 2004-10-08
  • 打赏
  • 举报
回复

like this ?

Add....


Function formatStr(strText)
On Error Resume Next
strText = Trim(strText)
If strText="" Then
Exit Function
End If
strText = Replace(strText,"<","<") '左<
strText = Replace(strText,">",">") '右>
strText = Replace(strText,";",";") '分号
strText = Replace(strText,"'","'") '单引号
strText = Replace(strText,"""",""") '双引号
strText = Replace(strText,Chr(9)," ") '空格
strText = Replace(strText, Chr(10) & Chr(10), "<BR><BR>")
strText = Replace(strText,Chr(10),"<br>") '回车
strText = Replace(strText,Chr(13),"") '回车
strText = Replace(strText,Chr(32)," ") '空格
strText = Replace(strText,Chr(34),""") '双引号
strText = Replace(strText,Chr(39),"'") '单引号
strText = Replace(strText,"script","&#115cript") 'script
strText = Replace(strText,"(","(") '左(
strText = Replace(strText,")",")") '右)
strText = Replace(strText,"--","--") 'SQL注释符
FormatStr = strText
End Function

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧