P
phil
Hi,
Is this a javascript or asp.net problem?
When the button is clicked, the server event in the code-behind must be
executed if the user clicked on "OK" of the Confirm and not executed if
clicked on "Cancel". I tried two ways: the first here below works perfect
but the second way ALWAYS executes the server event!!
Can anybody explain me why?
Thanks
Phil
First way (this works)
--------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="return confirm('are you sure?');" />
</form>
Second way (server event is always executed)
----------------------------------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="hfd();" />
</form>
<script language="javascript" type="text/javascript">
function hfd()
{return confirm("are you sure?")}
</script>
Code-behind (vb.net):
Is this a javascript or asp.net problem?
When the button is clicked, the server event in the code-behind must be
executed if the user clicked on "OK" of the Confirm and not executed if
clicked on "Cancel". I tried two ways: the first here below works perfect
but the second way ALWAYS executes the server event!!
Can anybody explain me why?
Thanks
Phil
First way (this works)
--------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="return confirm('are you sure?');" />
</form>
Second way (server event is always executed)
----------------------------------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="hfd();" />
</form>
<script language="javascript" type="text/javascript">
function hfd()
{return confirm("are you sure?")}
</script>
Code-behind (vb.net):