\ n似乎在IE中不起作用

时间:2012-03-19 22:56:22

标签: jquery json

以下是它在IE中的外观

I replied back ______________________________ I replied to you 
______________________________ MonList

以下是它在FF中的表现:

I replied back


______________________________

I replied to you


______________________________

MonList

这是在FF和IE使用的响应中发回的JSON:

{
    "message": [
        {
            "name": "John Doe (3)",
            "subject": "RE: RE: MonList",
            "message": "I replied back\n\n\n______________________________\n\nI replied to you\n\n\n______________________________\n\nMonList",
            "date": "3/19/2012 4:28:37 PM",
            "senttotal": "Distributor (1)"
        }
    ]
}

我是否需要做一些不同的事情让IE对待\ n和FF一样?

以下是从数据库中获取信息并将其放入JSON的代码:

特别是m.Message

sql = ""
    sql = sql & " SET NOCOUNT ON"
    sql = sql & " SELECT m.ID, m.DistID, m.StatusID, m.Subject, REPLACE(REPLACE(REPLACE(m.Message, CHAR(10), '\n'), CHAR(13), '\n'), CHAR(9), '') AS Message, m.CreatedDate, m.SentTotal, d.FName + ' ' + d.LName AS Name"
    sql = sql & " FROM message m"
    sql = sql & " INNER JOIN Distributor d ON m.DistID = d.DistID"
    sql = sql & " WHERE m.ID = " & CInt(request("messageid"))

2 个答案:

答案 0 :(得分:3)

为什么不使用<br />来换行。

答案 1 :(得分:0)

在Windows中,您通常需要执行\n\r