开发者

Validation on confirming Alert

Script

<script language="javascript" type="text/javascript">
     function FinalFun开发者_JS百科ction() {
         //Your First Script
         return  confirm('Are you sure about to submit the test?');
     }
</script>

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:FinalFunction();" OnClick="Button1_Click" />

This script is showing the confirmation alert message but either on clicking OK or Cancel Button, the page is redirecting to another page.

What I want is when I click on the Cancel Button, the page should be on same page, it should not redirect to another page.

How do I do it?


OnClientClick = "return FinalFunction();"?


modify your function:

function FinalFunction() {
    confirm('xxx');
    return false;
}

but when would you like to redirect your page?


The button does a postback, do you redirect to another page in your .NET code-behind class?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜