Close ShowModalDialog and refresh the parent page

Source: Internet
Author: User

 

Window is used in the project. showModalDialog (url) opens the modal dialog box. After the operation is complete, close the dialog box and refresh the parent page. In the subwindow, use window. dialogArguments. location. reload (true); prompt "window. dialogArguments. location is null or not an object ".

Google found that some parameters of the showModalDialog method are as follows:

Usage:
VReturnValue = window. showModalDialog (sURL [, vArguments] [, sFeatures])
Parameter description:
SURL
Required parameter. Type: string. Specifies the URL of the document to be displayed in the dialog box.
VArguments
Optional parameter; Type: variant. Used to pass parameters to the dialog box. The passed parameter types are not limited, including arrays. The dialog box uses window. dialogArguments to obtain the passed parameters.
SFeatures
Optional parameter; Type: String. Used to describe the appearance and other information of the dialog box. You can use one or more of the following, separated by semicolons.
In the dialogHeight dialog box, the height is not smaller than px. In IE4, the default unit of dialogHeight and dialogWidth is em, while in IE5, the default unit is px. For convenience, When you define the modal mode dialog box, unit with px.
DialogWidth: Dialog Box width.
DialogLeft: The left distance from the desktop.
DialogTop: the distance from the desktop.
Center: {yes | no | 1 | 0}: whether the window is centered. The default value is yes, but the height and width can still be specified.
Help: {yes | no | 1 | 0}: whether to display the help button. The default value is yes.
Resizable: {yes | no | 1 | 0} [IE5 +]: whether the size can be changed. No by default.
Status: {yes | no | 1 | 0} [IE5 +]: whether to display the status bar. The default value is yes [Modeless] or no [Modal].
Scroll: {yes | no | 1 | 0 | on | off}: Specifies whether the scroll bar is displayed in the dialog box. The default value is yes.

Sadly, window. showModalDialog (url, window) does not report an error, but continues to be invalid ......

 

Google found the working mechanism of the modal web page dialog box. After the original parent window is called, it will stay in the window. showModalDialog (url, window); on this statement, that is, when the parent page opens the modal dialog box, js stays on it, and the code behind it is not executed. You can use the following method to refresh the parent page:

Window. showModalDialog (url, window );
Location. reload ();

 

At the same time, you can accept the return value var result = window. showModalDialog (url, window );

var result=window.showModalDialog('"+url+"','window','dialogHeight:400px;dialogWidth:800px;help:no;status:no');document.getElementById(\"hide_IfSet\").value=result;location.reload(); 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.