在javascript中引用的文本中插入换行符 [英] inserting line breaks in text quoted in javascript
问题描述
我正在使用javascript进行一些文本交换,让它工作正常,但
我希望该行有换行符并成为初学者,我
。我甚至都不知道这是否可行。
所以我有这样一条线
swaptext(''Shaun,Greg,Violet,Joel,1999'' )
是否有一个简单的方法来做这个?b $ b?我发誓我已经看到了一种方法,但现在我似乎无法找到它。
alice写道:
我正在用javascript进行一些文本交换,让它工作正常,但
我想要行到我有点换行和初学者,我不知道这是否可能。
所以我有这样一条线
swaptext(''Shaun,Greg,Violet,Joel,1999'')" ;;
我想让1999年换上新的一行。是否有一个简单的方法来做这个?b $ b?我发誓我已经看到了一种方式,但现在我似乎无法找到它。
新线在哪里?在源代码中?在网页中?
和函数swaptext()是什么?吗?
这么多的问题...
Mick
3月17日下午4:47,迈克尔White< m ... @ mickweb.comwrote:
alice写道:
我''我正在用javascript进行一些文本交换,让它工作正常,但是
我希望这行有换行符并且是初学者,我
甚至不行知道这是否可行。
所以我有这样的一行
swaptext(''Shaun,Greg,Violet,Joel,1999'')" ;; br />
我希望1999年换上新的一条线。是否有一个简单的方法来做这个?b $ b?我发誓我已经看到了一种方式,但现在我似乎无法找到它。
新线在哪里?在源代码中?在网页中?
和函数swaptext()是什么?吗?
这么多的问题...
Mick
对不起,我应该解释一下。它是onclick
函数的一部分
onClick =" if(document.images)document.images [''blank'']。src =' 'images /
new.gif''; swaptext(''Shaun,Greg,Violet,Joel,1999'')" ;;>
图像交换和文本交换的功能都在
$ b $中b html的负责人,这一切都很完美。我只想知道
,如果有办法在''1999'之前插入换行符。如果它已经是javascript行中的引用,我怎么办
?我不能只是
添加一个< brbefore it。
alice写道:
我正在用javascript进行一些文本交换,让它工作正常,但是
我想要行有行打破并成为初学者,我不知道这是否可能。
所以我有这样的一行
swaptext (''Shaun,Greg,Violet,Joel,1999'')" ;;
我希望1999年能够进入一个新的界限。是否有一个简单的方法来做这个?b $ b?我发誓我已经看到了一种方式,但现在我似乎无法找到它。
swaptext(''Shaun,Greg,Violet,Joel,\ nn1999'')" ;;
将为文本工作,为HTML -use:
swaptext(''Shaun,Greg,Violet,Joel,< br1999'')" ;;
I''m doing some text swapping with javascript, got it working fine, but
I would like the line to have line breaks and being a beginner, I
don''t even know if this is possible.
So I have a line like this
swaptext(''Shaun, Greg, Violet, Joel, 1999'')";
and I would like 1999 to be on a new line. Is there a simple way to do
this? I''d swear I''ve seen a way, but now I can''t seem to find it.
alice wrote:
I''m doing some text swapping with javascript, got it working fine, but
I would like the line to have line breaks and being a beginner, I
don''t even know if this is possible.
So I have a line like this
swaptext(''Shaun, Greg, Violet, Joel, 1999'')";
and I would like 1999 to be on a new line. Is there a simple way to do
this? I''d swear I''ve seen a way, but now I can''t seem to find it.A new line where? In source code? In web page?
And what does the function "swaptext()" do?
So many qustions...
Mick
On Mar 17, 4:47 pm, Michael White <m...@mickweb.comwrote:alice wrote:I''m doing some text swapping with javascript, got it working fine, but
I would like the line to have line breaks and being a beginner, I
don''t even know if this is possible.
So I have a line like this
swaptext(''Shaun, Greg, Violet, Joel, 1999'')";
and I would like 1999 to be on a new line. Is there a simple way to do
this? I''d swear I''ve seen a way, but now I can''t seem to find it.
A new line where? In source code? In web page?
And what does the function "swaptext()" do?
So many qustions...
MickSorry, I should have explained more. It''s all part of an onclick
function
onClick="if (document.images) document.images[''blank''].src = ''images/
new.gif''; swaptext(''Shaun, Greg, Violet, Joel, 1999'')";>
The functions for both the image swap and the text swap are in the
head of the html, and it''s all working perfectly. I just want to know
if there is a way to insert a line break before ''1999''. How do I do
that when it is already a quote within a javascript line? I can''t just
add a <brbefore it.
alice wrote:I''m doing some text swapping with javascript, got it working fine, but
I would like the line to have line breaks and being a beginner, I
don''t even know if this is possible.
So I have a line like this
swaptext(''Shaun, Greg, Violet, Joel, 1999'')";
and I would like 1999 to be on a new line. Is there a simple way to do
this? I''d swear I''ve seen a way, but now I can''t seem to find it.swaptext(''Shaun, Greg, Violet, Joel, \n1999'')";
will work for text, for HTML -use:
swaptext(''Shaun, Greg, Violet, Joel,<br1999'')";
这篇关于在javascript中引用的文本中插入换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!