求教将文本格式化输出的代码

sunpenguin 2001-07-20 10:40:36
哪位可以提供从页面向后台ACCESS 的备注型字段内添加文本后,使其能按原输入样式显示的代码,即保留字号,字体信息和段落格式。谢谢
...全文
71 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
freezwy 2001-07-21
  • 打赏
  • 举报
回复
你说的情况要使用UBB了,参考CSDN“文档中心”的哪个东西,用JS弄的。
如果不考虑字体信息,我给你个函数。
<%
function htmlencode2(str)
dim result
dim l
if isNULL(str) then
htmlencode2=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case chr(13)
result=result+"<br>"
case chr(34)
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 chr(9)
result=result+" "
case else
result=result+mid(str,i,1)
end select
next
htmlencode2=result
end function
%>
读取或者写入数据库时调用就可以
sunpenguin 2001-07-21
  • 打赏
  • 举报
回复
谢谢

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧