储存时:
<%
function HtmlEncode(str)
on error resume next
Dim result,L
if isnull(str) then
HtmlEncode=""
Exit function
end if
L=len(str)
Dim i
for i=1 to L
select case mid(str,i,1)
case "<"
result=result&"<"
case ">"
result=result&">"
case "&"
result=result&"&"
case "'"
result=result&"''"
case chr(13)
result=result&"<BR>"
case chr(9)
result=result&" "
case chr(32)
if i+1<=L and i-i>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
end if
HtmlEncode=result
end function
%>
也就是把HTML标准后再存入数据库
需要现在是编辑框之前,先用以下函数:
<%
function HtmlDecode(str)
on error resume next
str=replace(str,"<","<")
str=replace(str,">",">")
str=replace(str,"&","&")
str=replace(str,"<BR>",chr(13))
str=replace(str," ",chr(32))
if err.number<>0 then
err.clear
end if
HtmlDecode=str
end function
%>
都是,一个html页面里面包括这些标记!html是整个页面的标记
head是页面头的标记
title是标题的标记
body是页面内容的标记
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)