html - confirmation on button not working -
for reason, confirmation function not working. here code:
<tr> <td align ="right" style ="width: 50%;"> <asp:button id="button1" runat="server" text="confirm order" onclick="button1_click" onclientclick="confirm();" /> <script type="text/javascript" language="javascript" > function confirm() { if (page_clientvalidate()) return confirm('confirm order?'); } </script> </td> <td align ="left" style ="width: 50%;"> <asp:button id="button2" runat="server" text="cancel order" onclick="button2_click" onclientclick="cancel();" /> <script type="text/javascript" language="javascript" > function cancel() { if (page_clientvalidate()) return confirm('cancel order?'); } </script>
obviously want happen have confirmation when client clicks on button. line of codes fine in other pages. however, not working since calling function inside user control, have it?
thank help/tricks.
there should no return @ onclientclick="return validate();" should onclientclick="validate()" see code @ https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick%28v=vs.110%29.aspx?f=255&mspperror=-2147217396
Comments
Post a Comment