储存时:
<%
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语言中换行的代码是<br>或<p></p>。
1、HTML换行的代码是<br>,想要在哪一行换行,在那一行的代码后输入<br>代码即可实现换行
操作。这个方法是最简单的。
2、<P>是空白行,一个<P>一行,两个<P>两行。
3、如果有了<PRE>??</PRE>,从<PRE>到</PRE>中的内容原来怎么分的行,就怎么分,不加
<br>。
扩展知识:
HTML字符集:
在网页中除了可显示常见的美国信息交换标准代码(外语缩写:ASCII)字符和汉字外,HTML还有
许多特殊字符,它们一起构成了HTML字符集。有2种情况需要使用特殊字符,一是网页中有其特殊
意义的字符,二是键盘上没有的字符。
HTML字符可以用一些代码来表示,代码可以有2种表示方式。即字符代码(命名实体)和数字代码
(编号实体)。字符代码以“&”符开始,以分号""结束,其间是字符名,如&reg。数字代码也
以“&#”符开始,以分号""结束,其间是编号,如®。
参考资料:百度百科:HTML