开发者

extJS didnt see too big text with many <br>'s

extJS didnt see too big text with many <\b开发者_JS百科r>'s..

If i write text something like "lalal lalalal lsadsdhas afjhjhj"; Its okei, works.

If i write text with \n (<\br>) something like:

"hello,

my name

is Polly!";

ExtJS didnt see those lines. How i can avoid this?

Thank you!


This is because Javascript doesn't allow multi-line strings. If you want a linebreak in your string, it has to be coded with an escape sequence like '\r\n'. So,

alert("hello, \r\nmy name\r\nis Polly!");

will display as 3 lines. If the string is going into an html element, then insert '<br />' in place of the '\r\n'. finally, if you need a long string with lots of blank spaces between the words, for some reason, you can either keep typing on the same line, or break it up into several lines and combine the lines with the '+' operator, like this:

var longstring = 
'hello                                                       \r\n'
+'my name                                                    \r\n'
+'is Polly!';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜