开发者

javascript function in confirmation button?

开发者 https://www.devze.com 2023-02-28 19:13 出处:网络
How to have a confirmation button in my codes below? (Yes - cancel) ClientScript.RegisterStartupScript(typeof(Page), \"key\", \"<script>alert(\'There is an exiting Insurance code. Are you sure

How to have a confirmation button in my codes below? (Yes - cancel)

ClientScript.RegisterStartupScript(typeof(Page), "key", "<script>alert('There is an exiting Insurance code. Are you sure do you want to Edit it?');</script>");

I tried this one but its not working..

 ClientScript.RegisterS开发者_Go百科tartupScript(typeof(Page), "key", "if(!confirm('There is an existing insurance code . Do you want to edit?'))return false;");

thanks!


Use javascript confirm dialog instead of alert.

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.");
    }
}


Use the confirm function.

It's probably worth noting that usability principles often frown upon this

Edit Probably something along the lines of

if (confirm('There is an exiting Insurance code.' + "\n" + "Are you sure you want to Edit it?"))
    ClientScript.RegisterStartupScript(typeof(Page));
0

精彩评论

暂无评论...
验证码 换一张
取 消