function showDialog() { blah; blah; // your code here button name=choice onclick="processChoice();" } function processChoice() { /// code here to take action depending on choice made } showDialog(); // this will display the dialog and present the user with a choice