I got tired of the limits of
So I rolled my own and called it jsMsgbox. It can do nearly everything a native VBScript Msgbox can, including
full icon/buttons choices, control of the dialog title, and keyboard accessibility. Check it out..
In msgbox.js, path to js_msgbox.html will need to be adjusted to your application
(haven't found a way to make the path relative to the script file itself, rather than to the page which includes it).
Use these to compare to the value returned from the Msgbox function.
Unlike a real VBScript Msgbox, jsMsgbox can't accept the actual constants.
Instead, it takes a string of the constant names.
This may change in a future version (when I figure out how to pull apart bitwise "OR"-ed constants).
With particularly odd or large sizes of prompt text, there might be strange text flow artifacts
as the function tries to guess how large to make the dialog.
(Unfortunately there's just no good way to detect the true size used by text in the browser.) Update:jsMsgbox now resizes itself to the size of the text much more accurately.
A VBScript Msgbox disables the dialog window "X" button when vbAbortRetryIgnore is chosen (since cancel isn't an option).
jsMsgbox cannot do this.
The vbSystemModal constant has no effect. Only vbApplicationModal is possible (default).
XP SP2 Compatibility:
Unfortunately, Service Pack 2 for Windows XP slightly uglifies jsMsgbox when used on public websites. When run in IE's Internet Zone, jsMsgbox shows a status bar at the bottom (which look strange on a dialog). This is because SP2 now forces status bars on on all popup windows (ignoring the "status:no" directive), including the modal/modeless dialogs on which jsMsgbox relies (ref, ref). Note that this only happens in IE's Internet Zone, so Intranet web apps (which it's best for anyway) running in IE's Local Intranet or Trusted Zones are unaffected.
Update:jsMsgbox now automatically detects if it is likely to be affected by these changes, and pads the dialog's height to suit.
I wish there was a way to make jsMsgbox work in Firefox "and the rest," but those browsers sadly don't support window.showModalDialog(), by which this is accomplished. jsMsgbox shouldn't even be necessary, though, in this new heyday of client-strong web apps like Gmail, MSN Search, and A9. Highly conspicuous in their absence from the standard browser DOM are window.showModalDialog() and window.showModalDialog(), as well as a new window method like window.msgbox(). The benefit of having these be widely supported (and W3C standard) would be immense to client-strong web app authors.
(That's not even discussing DHTML behaviors or DSOs... And people wonder why there are so many IE-only web apps!).