Window. showModalDialog refresh the parent window and the method and note of the current window. showmodaldialog

Source: Internet
Author: User

Window. showModalDialog refresh the parent window and the method and note of the current window. showmodaldialog

Window. showModalDialog methods and notes for refreshing the parent window and the current window:
 
I. Method to refresh the parent window:
A. Use window. returnValue to pass A value to the parent window, and then judge whether to refresh the window Based on the value.

On the window. showModalDialog window page, use window. returnValue to set the return value;
For example, window. returnValue = 'refresh ';

B. When writing window. showModalDialog window function, define a variable and operate the parent window according to the variable value;
Example: varwinPar = window. showModalDialog (urls, 'erpwindows', 'dialogwidth = '+ widths + 'px; dialogHeight =' + heigths + 'px; status = no; center = yes; scroll = no ');
If (winPar = "refresh ")
Window. location. reload (); // executed when the window. showModalDialog window is closed
The return value set by winPar for step A in the showModalDialog window

Conclusion: The window. showModalDialog function opens an IE mode window (that is, the parent window cannot be operated after the window is opened, and the operation can only be performed when the mode window is closed ),

Therefore, to refresh the parent window, you can only execute it after the mode window is closed. Window. returnValue can be used to pass a value to the parent window, so that the value can be transferred to the parent window in the mode window,
 
Then, refresh the parent window based on the value. In this way, the parent window will be automatically refreshed after any Mode window is closed.

Ii. Refresh mode this window
The showModalDialo window is different from the window opened by window. open When refreshing this window, the showModalDialo window cannot be refreshed with F5 or right-click
A. Add the following content to the mode window:
<Base target = "_ self"> // between html and body
<A id = "reload" href = "url of this page" style = "display: none"> </a>

B. Execute the following js Code where the refresh operation is required:
Reload. click (); // reload indicates the id of the hidden A tag in a. You can change it to another name.


3. Notes

When you click the link in the window. showModalDialog window, a new window is opened. To prevent the new window from being opened, you need
Add: <base target = "_ self"/>.

Related Article

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.