如何在下面的代码中设置确认按钮? (是 - 取消)
ClientScript.RegisterStartupScript(typeof(Page), "key", "<script>alert('There is an exiting Insurance code. Are you sure do you want to Edit it?');</script>");
我试过这个,但它不起作用..
ClientScript.RegisterStartupScript(typeof(Page), "key", "if(!confirm('There is an existing insurance code . Do you want to edit?'))return false;");
谢谢!
答案 0 :(得分:2)
使用javascript confirm对话框而不是提醒。
function confirmation() {
var answer = confirm("There is an exiting Insurance code.
Are you sure do you want to Edit it?")
if (answer){
alert("You clicked OK.");
}
else{
alert("You clicked Cancel.");
}
}
答案 1 :(得分:0)
使用confirm
功能。
可能值得注意的是,可用性原则经常不赞成这个
编辑可能是
的内容if (confirm('There is an exiting Insurance code.' + "\n" + "Are you sure you want to Edit it?"))
ClientScript.RegisterStartupScript(typeof(Page));