How do I write a dialog box for Firefox? _ Application Tips
Source: Internet
Author: User
When you design a blog operation process, you plan to use a pop-up dialog box to add and modify pages. At the end of Add and modify, click Submit, the dialog box closes, and the following list window refreshes. This will feel like using Windows interface program, the interface is very friendly.
But in the actual operation occurred a problem, ie dialog box technology, Firefox is not supported, how to do both support IE and Support Firefox dialog box?
Fortunately, yesterday in the research TINYMCE, there are support Firefox dialog box technology can learn from.
I wrote the method of opening the dialog box:
function Popupdialog (url,width,height) {
SHOWX = event.screenx-event.offsetx-4-10; + DeltaX; This code is only valid for IE, no longer used.
showy = event.screeny-event.offsety-168; + DeltaY; This code is only valid for IE, no longer used.
var x = parseint (screen.width/2.0)-(width/2.0);
var y = parseint (screen.height/2.0)-(height/2.0);
var ismsie= (Navigator.appname = = "Microsoft Internet Explorer"); Judge the browser
In the Open dialog box, I used the page with the up and down frame, because in IE, the dialog box is not submitted, but after the frame, it can be submitted.
On the Submit button, add this piece of code:
function Doreload () {
var ismsie= (Navigator.appname = = "Microsoft Internet Explorer");
if (Ismsie) {
Parent.dialogArguments.location.reload ();
}else{
Parent.opener.document.location.reload ();
}
Top.close ();
}
The two browsers open the dialog box in a different way
IE:window.showModalDialog (URL, window, "dialogwidth:300px; dialogheight:300px; dialogleft:200px; dialogtop:200px; Status:no; Directories:yes;scrollbars:no; Resizable=no; " );
FireFox:window.open (URL, "Mcepopup", "top=200,left=200,scrollbars=no,dialog=yes,modal=yes,width=300,height=300, Resizable=no ");
When closing a window:
IE:parent.dialogArguments.location.reload ();
FireFox:parent.opener.document.location.reload ();
There is also a very important point to note. Firefox does not seem to support the dialog box Window.close ();
So the last use of the closed window is top.close (); This IE, Firefox are supported.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.