textarea中的首行开始的空格为何无法post

kevinliuu 2006-05-31 03:55:52
文本域中输入信息,为何首行开始的空格无法捕获?

提交时再拿来显示时,开头的空格总是没有,这个要怎么才能捕获并post?
...全文
307 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
robake 2006-06-01
  • 打赏
  • 举报
回复
上边的代码为asp代码
kevinliuu 2006-05-31
  • 打赏
  • 举报
回复
另外我提交时没有trim()
kevinliuu 2006-05-31
  • 打赏
  • 举报
回复
js吗?

看不懂......
robake 2006-05-31
  • 打赏
  • 举报
回复
一般是用trim去掉了空格.
你可以将文本内容转换成html格式后再使用.
可以参考使用以下代码:
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 "<"
result=result+"<"
case ">"
result=result+">"
case chr(13)
result=result+"<br/>"
case chr(34)
result=result+"""
case "&"
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
kevinliuu 2006-05-31
  • 打赏
  • 举报
回复 1
我倒,居然csdn也是这样。 这一行的开头有两个空格的
看看第二行有没有

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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