First, if the dialog box is truly modal, it should not have a "back" button. The modal behavior means that you should work only with one dialog, not other windows, complete the work, and close it; when you close it, you will be on the same page anyway. So, the dialog box can have a "Close" button or "OK" (which I don't like, because — what is OK?), along with others like "Cancel".
Strictly speaking, strongly modal behavior is not possible with Web applications because you can always create any number of Web browser's windows with the same URI and switch to them having a modal dialog box open, so your application should handle such cases. Your application should suggest the user to work with only one window and use modal behavior where required but be prepare to handle the situations when the user does something different.
I would recommend to use
jQuery for modal dialog or a modal window. There is a big number of components around. To get a pretty good idea, look at these three:
http://jqueryui.com/demos/dialog/[
^],
http://jquery.com/demo/thickbox/[
^],
http://www.queness.com/resources/html/modal/jquery-modal-window.html[
^].
See also:
http://en.wikipedia.org/wiki/JQuery[
^],
http://docs.jquery.com/Main_Page[
^].
You can choose from more than a million search results:
http://bit.ly/z5A3TB :-)[
^].
—SA