--The preface--
The alert and confirm standard methods for window objects do not display the same in different browsers, and there is a common point that is not very attractive. Our idea is to use JS and CSS to imitate them, to provide another set of functions, so that in different browsers have the same experience effect.
--Design idea--
To preserve the original alert and confirm methods, instead of directly replacing alert and confirm for the Window object, we create a new win object with alert, confirm, open, close, and so on. Win.alert, etc. dialog box pop-up layer, using the IFRAME as the bottom layer, make sure that the dialog box can also overwrite the select label at the bottom when the IE7 is ejected, and that the script will not block when it pops up, so functions like Win.alert provide a callback parameter that triggers the dialog box when it is closed or selected. Callback parameter, the function prototype is as follows:
Win.alert = function (title, message, closed) {...}//alert
win.confirm = function (title, message, selected) {...} Confirm
Win.open = function (width, height, title, URL, closed) {...}//pop-up page dialog box
--the results show--
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, but also hope that a lot of support cloud Habitat community!