开发者

Validation on confirming Alert

开发者 https://www.devze.com 2023-03-04 21:09 出处:网络
Script <script language=\"javascript\" type=\"text/javascript\"> function FinalFun开发者_JS百科ction() {

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

精彩评论

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