gpt4 book ai didi

javascript - 脚本管理器.RegisterStartupScript

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:51:17 24 4
gpt4 key购买 nike

我有这个代码:

ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Ouve algum problema nos itens " + text + "');", true); 

其中 text 是一个字符串,因为我试图在短信中插入一个 \n 但没有显示任何内容。

最佳答案

您的代码文本需要两个转义符。

string text = "test \\n testing";
ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Ouve algum problema nos itens " + text + "');", true);

使用:

string text = "test \\n testing";

代替:

string text = "test \n testing";

关于javascript - 脚本管理器.RegisterStartupScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4464075/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com