javascript - cancel button not redirecting to separate page -


i have asp.net form cancel button supposed to, after confirmation user, redirect them page. i'm using javascript this. works fine in simple html page, apparently interfering on .aspx page. popup message works perfectly, clicking "okay" not take page. have tested if statement , working correctly, thing won't leave current page.

my javascript:

<script type="text/javascript"> <!--     function confirmation() {         var answer = confirm("are sure want cancel? information have entered discarded.")         if (answer) {             window.location = "index.htm";         }     } --> </script> 

my button:

<asp:button id="btncancel" runat="server" text="cancel" onclientclick="return confirmation();" causesvalidation="false" /> 

set usesubmitbehavior property of button control false:

<asp:button usesubmitbehavior="false" id="btncancel" runat="server" text="cancel" onclientclick="return confirmation();" causesvalidation="false" /> 

Comments