This method can be directly accessed from anywhere with code like this:
wwModalDialog.MessageBox("your message","your title","Yes","No",MBoxHandler); function MBoxHandler(Result,buttonElement) { if (Result == 1) alert("Yes"); else alert("No"); }
Note if you use this function a generic dialog is created and you have no control over the formatting other than the actual message. If you need to format the dialog you'll need to use the instance class and hook up the appropriate dialogId,contentID and headerId properties.
The function returns an instance of the wwModalDialog class, so you can potentially further format it by accessing the boxObj and ovObj properties of the instance.
static wwModalDialog.messageBox(Message,Title,OkButton,CancelButton,MBoxHandler)
Title
The title to display. This value is provided as text always (no html formatting can be provided).
OkButton
The caption for the Ok button
CancelButton
The caption for the second/cancel button. If not provided the button is not shown.
MBoXHandler
Optional client script handler called when a button is clicked. 0 for cancel, 1 for ok. The handler also receives an instance of the button element so you can retrieve the button caption (Button.value)