0

我正在尝试输出一系列由换行符分隔的滚动文本消息。

我的代码如下所示:

<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>

任何人都可以帮我修复它以便显示换行符吗?我已经尝试了所有我能想到的东西,包括标签等等。

谢谢!

4

1 回答 1

0

使用<pre>保留空格的 HTML 元素。否则替换\n<br>.

于 2013-02-11T19:46:23.867 回答