How to pop up and return data on pages in IE, Firefox, and operabrowsers

Source: Internet
Author: User

In ie, the js method showmodaldialog () can be used directly in the pop-up modal box. This method is supported after firefox3.0, but not in earlier versions of Firefox and opera. the JS standard window is required. open () method.

Window. Open Syntax:

Onewwindow=Window. Open ([Surl][,Sname][,Sfeatures][,Breplace])

Returns the object on the current pop-up page. In the pop-up window, you can useWindow. OpenerTo obtain the parent window object, you can directly access the client control of the parent window or call its js method for operations:

Window. Opener. Setvalues (val1, val2 ...);

This problem is often encountered during actual development. the parent window is refreshed based on the value returned by the Child Window, but this refresh is generally only partial, rather than refreshing the entire page. in this case, AJAX can be used to call the background method in Js. however, I recommend another refresh method, which is simpler, more convenient, and effective. it is to virtualize a button in JS and refresh the page by clicking the button in the corresponding function.

Function setvalue (strmsg)
{
// You can record the passed value to the hidden control,
// Later, the button response function operates from the value of the hidden control.
VaR button = Document. getelementbyid ("<% = button2.clientid %> ");
Button. Click ();
}

In this way, the pop-up page box in IE, Firefox, and opera is implemented and the value is returned.

You can place the button that is clicked in a div and set the display attribute of the DIV to "NONE", because if the size of the button is set to (0, 0, the display in Firefox and opera is abnormal. for details, refer to the source code, default. the ASPX page is the parent page, child. aspx is a sub-page, which defaults when running. set aspx to the starting page.

Source code:

Page refresh of window. Open Method

<Transferred from> Molby home brothers blog

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.