Re: JavaScript confirm
- From: "Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@xxxxxxxxxxxx>
- Date: Thu, 26 Oct 2006 11:10:28 +0200
Are you asking on the server side? Your code already does it. If Cancel is
clicked, the event won't propagate to the server.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<rn5a@xxxxxxxxxxxxxx> wrote in message
news:1161853312.870679.122810@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have gone through a no. of posts in this NewsGroup regarding my
problem but alas, couldn't come across one which would have helped me
in resolving the issue. My problem is this:
An ASPX Form has a Button. When the Button is clicked, I want a
JavaScript confirm dialog to pop-up with the options 'OK' & 'Cancel'. I
have done this using the following code:
Sub Page_Load(....)
btnClick.Attributes.Add("OnClick", "javascript:return confirm('Are
you sure you want to exit?');")
End Sub
where 'btnClick' is the name of the Button.
The problem is how do I find out which of the 2 buttons, 'OK' or
'Cancel', has a user clicked? Any one can help me out with this?
My primary intention is if the user clicks 'OK' in the confirm dialog,
then function1 should get executed but if the user clicks 'Cancel',
then function2 should get executed.
In JavaScript, if 'OK' is clicked, then confiorm returns 1; if 'Cancel'
is clicked, then confirm returns 0.
.
- Follow-Ups:
- Re: JavaScript confirm
- From: rn5a
- Re: JavaScript confirm
- References:
- JavaScript confirm
- From: rn5a
- JavaScript confirm
- Prev by Date: Re: IsPostBack == true, even though its a callback
- Next by Date: RE: print preview page question
- Previous by thread: JavaScript confirm
- Next by thread: Re: JavaScript confirm
- Index(es):
Loading