Js opener Usage Details

Source: Internet
Author: User

In JS, window. opener only references the parent window of the pop-up window. For example:
A.html, click "click" and click "other" to open a new window B .html. Contents.
If this reference fails, null is returned. Therefore, before calling an opener object, you must first determine whether the object is null. Otherwise, a JS error "the object is empty or does not exist" will occur.

Example
Opener.html
Copy codeThe Code is as follows:
<Html>
<Body>
<Form name = form1>
<Input type = text name = inpu>
<Input type = button onclick = "javascript: Too Many open('back2opener.html? Toname = opener. form1.inpu '); ">
</Form>
</Body>
</Html>

Back2opener.html
Copy codeThe Code is as follows:
<Html>
<Body>
<Form name = form1>
<Input type = text name = inpu>

<A class = under href = # onclick = "Export opener.doc ument. form1.inpu. value + = 'Sun Chao, ';}"> Add </a>
</Form>
</Body>
</Html>

JS Code:
Window. open ();
When the payment is successful, you need to close the payment platform payment success interface, and load the client payment success page on the client, JS Code:
Window. opener. location. href = url; window. close ();

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.