question on dialog box with yes/no buttons

buggiez

Member
Joined
Feb 7, 2006
Messages
18
Location
Singapore
Programming Experience
1-3
hi all.

lets say i want a button to fire a dialog box when clicked.... if u clicked on "yes", the process will continue; if clicked on "no", the process will stop.

this is just an example.

my questions is...in this code below... how do i continue the if then else statement?


Me.RegisterStartupScript("Success", "<script language='javascript'>confirm('Do you wish to submit?');</script>")


thanks alot..


valerie
 
Capture the return value from the confirm command and check it... for example:
var bConfirm = confirm('Do you with to submit');
if(bConfirm){
//proceed.
return bConfirm;
}

the line that says: return bConfirm will return back the true or false value based on if the user clicked yes or no. passing back false will halt the further javascript functions.

Here's the link to the msdn reference for DHTML/HTML. This is a must if you will be doing a lot of javascript. You can also use Visual Studio.NET to debug javascript if that is your development tool.
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/confirm.asp
 
Back
Top