Skip to content

Instantly share code, notes, and snippets.

@jmertic
Created March 15, 2011 21:06
Show Gist options
  • Save jmertic/871485 to your computer and use it in GitHub Desktop.
Save jmertic/871485 to your computer and use it in GitHub Desktop.
/* Creates an alert pop-up with the message 'Foo' */
YAHOO.SUGAR.MessageBox.show({msg: 'Foo'} );
/* Creates an alert pop-up with the message 'Foo' and title 'Bar' */
YAHOO.SUGAR.MessageBox.show({msg: 'Foo', title: 'Bar'} );
/* Creates a confirm pop-up with the message 'Foo' and title 'Bar' that does a particular action on callback based upon the button clicked */
YAHOO.SUGAR.MessageBox.show({msg: 'Foo', title: 'Bar', type: 'confirm',
fn: function(confirm) {
if (confirm == 'yes') {
//do something if 'Yes' was clicked
}
if (confirm == 'no') {
//do something if 'No' was clicked
}
}
});
/* Creates an plain pop-up ( with no 'OK' or 'Cancel' buttons ) with the message 'Foo' */
YAHOO.SUGAR.MessageBox.show({msg: 'Foo', type: 'plain'} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment