中华网校

系列网站: 中华网校 | www.网校.com | 3D模型 | 中华网校教育

电脑网校 | 业界新闻 | 职业网校 | 网校宝典 | 软件下载 | 网校论坛 | 网校联盟

电脑入门 | 网页设计 | 网络编程 | 图形图象 | 三维空间 | 多媒体 | 程序语言 | 操作系统 | 系统专题 | 办公应用 | 软件宝典 | 硬件天下 | 

 

您的位置:首页 >> 网络编程 >> ASP >> 新闻正文

转换html代码子程序  

作者:  时间:2004-7-17  来自:  责任编辑:  阅读次数:

function htmlencode(str)
on error resume next
dim result
dim l
if isnull(str) then
htmlencode=""
exit function
end if

l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(13)
result=result+"<br>"
case chr(9)
result=result+"    "
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case else
result=result+mid(str,i,1)
end select
next
if err.number<>0 then err.clear
htmlencode=result
end function

以上资料由动网先锋(http://www.aspsky.net)整理制作,转载请说明出处!

相关文章 最新文章 推荐文章
ASP脚本循环语句
SQL注入天书 - ASP注入漏洞全接触
数据库正规化和设计技巧
判断文章中文字符数量
利用ASP存取各种常用类型数据库(1)
利用ASP存取各种常用类型数据库(4)
ASP直接调用EXCEL数据的例子(不用ODBC)
如何正确显示数据库中的图片

  中华网校依法保护知识产权,如果我们的文章有涉及或侵犯您的有关权益,请即时与我们 联系, 注明网址及文章,我们会即时处理或删除,感谢您的合作!中华网校email
  中华网校由广州市中六电脑城智锐计算机专业培训学院及中华网校技术中心提供网络支持未经本站许可任何个人网站、书刊报社一律不得私自复制,转载本站内容!

关于中华网校 | 广告服务 | 版权声明 | 投稿指南 | 网站合作 | 友情链接 | 网站地图

 

版权所有 中华网校 & 智锐网校 1999-2004 COPYRIGHT (C) 1999-2004 www.ZhiRui.com ALL RIGHTS RESERVED

 
/**/