我弹出了一个 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);
页面上显示正常,但现在我需要添加以下行
"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);
我尝试添加一个休息
但不起作用(有道理),但我已经用尽了选择。
最佳答案
使用\n
而不是<br/>
因为它不是 htmt,根据您的情况,您应该使用 \\n
因为在 c# 中 \
应该是转义
关于c# - 向框中添加换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10221414/