读书人

纠正一上 TEXTAREA 的有关问题.

发布时间: 2012-10-08 19:54:56 作者: rapoo

纠正一下 TEXTAREA 的问题..
我是用asp+access,我在TEXTAREA输入的时候换行了,但存储到数据库中后是这样的,如图:
然后输出的时候显示没有换行了,中间成了一个空格。

代码是:<TEXTAREA name=explain id=explain rows=5 cols=66> </TEXTAREA>


输出时是<%=rs("explain")%>;

请问这个问题如何解决呀,谢谢了...

[解决办法]
楼主啊。。。。你不看下基础的不行啊。。。

HTML code
<!-- #include file="conn.asp"--><title></title><body scroll="no" marginwidth="0" leftmargin="0" topmargin="0"> <%Function codeTextarea(Byval str,Byval enType)    if isNul(str) then  codeTextarea = "" : Exit Function    select case enType        case "en"            codeTextarea = replace(replace(str,chr(13)&chr(10),"<br>"),chr(32)," ")        case "de"            codeTextarea = replace(replace(str,"<br>",chr(13)&chr(10))," ",chr(32))    end selectEnd Functiondim sql  Set cmdTemp = Server.CreateObject("ADODB.Command")  Set InsertCursor = Server.CreateObject("ADODB.Recordset")  cmdTemp.CommandText = "SELECT top 1 * FROM bao order by id desc"  cmdTemp.CommandType = 1  Set cmdTemp.ActiveConnection = conn  InsertCursor.Open cmdTemp, , 1, 3  InsertCursor.addnew  if carsortstr<>"" then  InsertCursor("carsort")=carsortstrend ifif Server.HTMLEncode(Request("month"))<>"" then  InsertCursor("month")=codeTextarea(Request("month"),"en")'''''''''''end ifif Server.HTMLEncode(Request("day"))<>"" then  InsertCursor("day")=codeTextarea(Request("day"),"en")end ifif Server.HTMLEncode(Request("explain"))<>"" then  InsertCursor("explain") =codeTextarea(Request("explain"),"en")''''''end if  InsertCursor.Update' response.write InsertCursor("id")' response.End' InsertCursor.movelast%><script language=Javascript><!--alert("您已成功登记相关信息!");window.location="nee.asp"--></script><%  InsertCursor.closeconn.close  set InsertCursor=nothing  set conn=nothing%>
[解决办法]
试了一下,输出还是空格,看了一下数据库,里面还是以换行的形式存储在里面,

可能不是换符号的问题吧

读书人网 >ASP

热点推荐