我已将此字符串存储在xml中...在ariabel中读取它然后使用下面的代码打印
$("#"+obj.id +" .frontText").html("<h2>"+fTitle[origImg]+"</h2>"+"<br/>"+backText[origImg]);
我想在此背景中打印换行符。怎么办我尝试过这样的人。
代码::
<backTxt>HarbourFront Tower One is an 18-storey office buillding which houses many blue-chip multinational corporations.
It was developed as part of the HarbourFront Precinct rejuvenation project to meet the growing demand of businesses relocating to the fringe of the CBD.
The development is located near supporting amenities and public transport.
</backTxt>
我想像这样打印:
HarbourFront Tower One是一幢18层高的办公大楼,里面有许多蓝筹跨国公司。 它是作为HarbourFront Precinct复兴项目的一部分而开发的,以满足企业迁移到CBD边缘的不断增长的需求。该开发项目位于配套设施附近 和公共交通。
答案 0 :(得分:3)
您正在输出HTML代码,HTML使用<br>
来表示换行符,因此您需要输出。