确认弹出消息(ASP.NET/VB)

时间:2011-04-30 00:31:08

标签: javascript asp.net vb.net popup confirm

当用户点击表单上的取消按钮时,我想弹出一个确认消息框。我相信这将是正确的JavaScript代码:

function confirmation() {
        var answer = confirm("Are you sure you want to cancel? Any information you have entered will be discarded.")
        if (answer) {
            window.location = "index.htm";
        }
    }

但是,我不确定如何从我的代码页面后面用VB调用该函数。

1 个答案:

答案 0 :(得分:0)

在取消按钮上添加此标记属性

OnClientClick="return confirmation();"
相关问题