【发布时间】:2013-02-11 19:43:32
【问题描述】:
我正在尝试输出一系列由换行符分隔的滚动文本消息。
我的代码如下所示:
<script type="text/javascript" src="xbMarquee.js"></script>
<script type="text/javascript">
<!--
//set the marquee parameters
function init() { down_marquee.start(); }
var down_marquee_Text = '<em>"This is a test comment. - Love from Admin /n"This is a far longer test comment which is of greater and more powerful value to the research portions of both physical, mental and citrus flavoured sciences all around the world for years to come."-Love PICKLES"</em>';
var down_marquee_Direction = 'down';
var down_marquee_Contents='<span style="white-space:nowrap;">' + down_marquee_Text + '</span>';
up_marquee = new xbMarquee('down_marquee', '100%', '90%', 6, 100, down_marquee_Direction, 'scroll', down_marquee_Contents);
window.setTimeout( init, 200);
-->
</script></div>
谁能帮我修复它以显示换行符?我已经尝试了所有我能想到的方法,包括标签等等。
谢谢!
奈
【问题讨论】:
-
换行符表示为
\n反斜杠 n,而不是/n -
刚刚尝试更改它,但仍然无法正常工作:(。不过感谢您的帮助!
-
好吧,无论如何,这不是您在 html 中打印换行符的方式,请参阅 Plynx 的答案,这只是您应该知道的任何一种方式。
标签: jquery html line-breaks