window.showModalDialog methods and notes for refreshing the parent window and the window

Source: Internet
Author: User

window.showModalDialog methods and notes for refreshing the parent window and the window:

I. How to refresh the parent window:
A. Use Window.returnvalue to pass values to the parent window and then determine whether to refresh by value.

Set the return value in Window.returnvalue mode on the window.showModalDialog window page;
For example: window.returnvalue= ' Refresh ';

B. When writing the window.showModalDialog popup function, define a variable and then manipulate the parent window based on the value of the variable;
For example: Varwinpar=window.showmodaldialog (URLs, ' erpwindows ', ' dialogwidth= ' +widths+ ' px;dialogheight= ' +heigths+ ' px; Status=no;center=yes;scroll=no ');
if (Winpar = = "Refresh")
Window.location.reload ();//When the window.showModalDialog window is closed, execute
Winpar The return value set to the ShowModalDialog window for step a

Summary: Because the window.showModalDialog function opens an IE mode window (that is, you cannot manipulate the parent window after opening, only when the mode window is closed),

So to refresh the parent window only executes when the modal window is closed. The window.returnvalue can be used to pass values to the parent window so that the values can be passed to the parent window using the From modal window.

It then refreshes by determining how the parent window is manipulated according to the value. This will automatically refresh the stepfather window in any closed mode window.

Two. Refresh mode this window
ShowModalDialog window and window.open open window when refreshing this window, Showmodaldialo window can not be refreshed with F5, there is no right-click operation
A. In the modal window page, add:
<base target= "_self" >//Between HTML and body
<a id= "Reload" href= "this page url" style= "Display:none" ></a>

B. Perform the following JS where you need to perform the refresh operation:
Reload.click ();//reload to hide the ID of a tag in a, of course it can be replaced by a different name


Three. Precautions

When you click the link in the window.showModalDialog window, a new window opens and you want to block the opening of a new window, between the HTML and the body in the window page.
Join: <base target= "_self"/>

window.showModalDialog methods and notes for refreshing the parent window and the window

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.