我试图创建一个确认对话框,但失败了。我的代码如下:
var node = parser.parseFromString('<p style="color: red">foo</p>', 'text/html').firstChild.lastChild.firstChild;
谢谢!
答案 0 :(得分:0)
Telerik的RadButton
控件包含用于显示确认消息的内置功能。最重要的是,您可以使用RadConfirm
或RadWindow
控件自定义弹出窗口体验,但这并不难实现。请务必查看附件中的链接以获取更多详细信息。
ASPX
<telerik:RadButton RenderMode="Lightweight" ID="btnStandardConfirm" runat="server" Text="Standard window.confirm" OnClientClicking="StandardConfirm" OnClick="Button_Click">
</telerik:RadButton>
背后的代码
protected void Button_Click(object sender, EventArgs e)
{
RadButton btn = sender as RadButton;
switch (btn.ID)
{
case "btnStandardConfirm":
Label1.Text = "The <strong>StandardButton</strong> submitted the page at: " + DateTime.Now.ToString();
break;
}
}
JS
function StandardConfirm(sender, args) {
args.set_cancel(!window.confirm("Are you sure you want to submit the page?"));
}
演示链接: http://demos.telerik.com/aspnet-ajax/button/examples/confirm/defaultcs.aspx