威凡网全力打造:网页编程、软件开发编程、平面设计、服务器端开发、操作系统等在线学习平台!学编程,上威凡网!
ASP教程>> ASP基础 应用技巧 数据库相关 ASP类 存储过程 FSO专栏 ASP其他
当前位置:首页 > ASP教程 > 应用技巧
上一节 下一节
 收集asp的常用函数
复制代码 代码如下:

function htmlencode(fstring)
if not isnull(fstring) then
fstring = replace(fstring, ">", ">")
fstring = replace(fstring, "<", "<")

fstring = replace(fstring, chr(32), " ")
fstring = replace(fstring, chr(9), " ")
fstring = replace(fstring, chr(34), """)
fstring = replace(fstring, chr(39), "'")
fstring = replace(fstring, chr(13), "")
fstring = replace(fstring, chr(10) & chr(10), "</p><p> ")
fstring = replace(fstring, chr(10), "<br> ")

htmlencode = fstring
end if
end function

function safe(str)'该函数用来判断传递过来的变量是否包含特殊字符,没有返回true 
dim s_badstr, n, i 
s_badstr = "'  &<>?%,;:()`~!@#$^*{}[]|\/+-="&chr(34)&chr(9)&chr(32) 
n = len(s_badstr) 
safe = true 
for i = 1 to n 
if instr(str, mid(s_badstr, i, 1)) > 0 then 
safe = false 
exit function 
end if 
next 
end function 


申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!
上一节 下一节
相关教程  
其他教程  
ASP基础
应用技巧
数据库相关
ASP类
存储过程
FSO专栏
ASP其他

违法和不良信息举报中心】邮箱:254677821@qq.com
Copyright©威凡网 版权所有 苏ICP备2023020142号
站长QQ:254677821