2012-04-19 26 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」這是通用換行符指標?