您的位置:首页 > 数据库

数据库字段内容存在'、"、>、<等特殊字符,转义html字符输出

2016-04-16 16:10 811 查看
GuestBook_Content=<span style='font: 14px/24px arial, 宋体, sans-serif, tahoma, "Microsoft YaHei"; color: rgb(69, 69, 69); text-transform:none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;'>“你好”这个词是在面对普通人,普通朋友,或者同学等一些关系比较普通的人所使用的语气词;</span>
//替换特殊字符
function HTMLEncodes(fString)if not isnull(fString) thenfString = Replace(fString, ">", ">")fString = Replace(fString, "<", "<")fString = Replace(fString, """, CHR(34))fString = Replace(fString, "'", CHR(34)) fString = Replace(fString, "  ", CHR(32)&CHR(32)) fString = Replace(fString, " ", CHR(32))fString = Replace(fString, "<br>", CHR(10)) fString = Replace(fString, "", CHR(13)) HTMLEncodes = fStringend ifend function
response.Write HTMLEncodes(ZXFD_GuestBook_Content)
<span style='font: 14px/24px arial, 宋体, sans-serif, tahoma, "Microsoft YaHei"; color: rgb(69, 69, 69); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;'>“你好”这个词是在面对普通人,普通朋友 ,或者同学等一些关系比较普通的人所使用的语气词;</span>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: