Window. showmodelessdialog method than window. the window popped up by the open method is different from the window popped up by the mode, so that the child window must be closed before the parent window can be operated. unfortunately, only IE is supported. The following method can bring up the Firefox "support" Mode window.
This method is inspired by the above cuteeditor. the pop-up window is modal, And the FF is to write a click method on the window. You only need to click the parent window to call the focus () of the Child Window () method, it seems to be "Modal"
VaR Useragent = Navigator. useragent. tolowercase ();
VaR Isfirefox = / Mozilla / . Test (useragent) && ! / (Compatible | WebKit) / . Test (useragent );
If (Isfirefox)
{
Window. showmodelessdialog = Function (URL)
{
VaR Windowname = (Arguments [ 1 ] = Null ? "" : Arguments [ 1 ]. Tostring ());
VaR Feature = (Arguments [ 2 ] = Null ? "" : Arguments [ 2 ]. Tostring ());
VaR Openedwindow = Window. Open (URL, windowname, feature );
Window. addeventlistener ( ' Click ' , Function () {Openedwindow. Focus ();}, False );
Return Openedwindow;
}
}
Else
{
// Parent window called in Child Window
// In ie, Use Role principal parent.doc ument
// Use Role extension opener.doc ument in FF
// The followingCodeThe method 'window. showmodelessdialog 'will be reloaded on IE and the parent window will be accessed using window. opener.
VaR Originfn = Window. showmodelessdialog;
Window. showmodelessdialog = Function (URL)
{
VaR Openedwindow = Originfn (URL, arguments [ 1 ], Arguments [ 2 ]);
Openedwindow. Opener = Window;
}
}
Function Popw ()
{
VaR Openedwindow = Window. showmodelessdialog ( ' Popwindow2.html ' , '' , ' Width = 400, Height = 400 ' );
}
it is actually very simple to say that it is broken, it's just a bit tricky to rewrite the showmodelessdialog method in IE below. originfn can "remember" The original showmodelessdialog method, which can be called in this way. I was surprised in my test.
through the above transformation, showmodelessdialog is much easier to use and compatible with the two browsers.
Source Code is not provided for downloading. All download files are posted.