2012-04-19 89 views
0

我有一个JavaScript框弹出一些消息,但我还没有找到如何从代码后面添加换行符,我被要求做到这一点,这里是它是如何工作原理:添加一个换行符到框

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", 
"function SendBox() {location.href = 'movetopage.aspx';} 
if(confirm('Move the items:" + myListOfItems + ". Do you want to continue? ') == true) 
{SendBox();};", true); 

这表明OK在页面上,但现在我需要添加以下行

"Clicking OK: Moves the items and continues" 

所以最终BOS应该表现出这样的

Move the items: Books, Magazines, Newspapers. Do you want to continue? 

Cliking OK: Moves the items and continues. 

注意第一行和第二行之间的中断?,我不知道如何将该代码添加到给定的代码中,我为Page.ClientScript提供的代码...等等。

我该如何添加在那里打破线弹出框?

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", 
"function SendBox() {location.href = 'movetopage.aspx';} 
if(confirm('Move the items:" + myListOfItems + ". Do you want to continue? 
<BR> 
Clicking OK: Moves the items and continues') == true) 
{SendBox();};", true); 

我尝试添加一个破
但不会工作(有意义),但我已用尽选择。

回答

1

使用\n insted的的<br/>监守它不是HTMT,你的病情,你应该使用\\n因为在C#\应该逃避

+0

你打败了我。 – SpeedCrazy 2012-04-19 03:56:33

+0

谢谢你,现在我添加了这个问题,页面只是继续做它的事情,从不停止并显示弹出窗口,就像js调用现在被忽略。奇怪的 :( – user710502 2012-04-19 04:11:59

1

你试过“\ n”这是通用换行符指标?