[Original] Two Methods for opening and closing old windows!

Source: Internet
Author: User
Tags old windows
1st Methods

The window to be opened is about.htm.

< Script Language = Javascript >

Function Openwin ()

{


Newwin = Zookeeper open('about.htm', 'login', 'location = No, Toolbar = No, status = Yes, resizable = No, scrollbars = No, menubar = No, directories = No ')

Newwin. moveTo ( - 3 , - 3 );

Newwin. resizeTo (screen. availwidth + 6 , Screen. availheight + 6 );



Window. Opener = Null ; // Opener is a container that represents the current window

Window. Close ();

}

</ Script >

2nd Methods

Write the statement for closing the old window in the onload event of the new window. This is more secure! That is, the new window is enabled, and the old window is closed.

Old window code

< Script Language = Javascript >

Function Openwin ()

{


Newwin = Zookeeper open('about.htm', 'login', 'location = No, Toolbar = No, status = Yes, resizable = No, scrollbars = No, menubar = No, directories = No ')

Newwin. moveTo ( - 3 , - 3 );

Newwin. resizeTo (screen. availwidth + 6 , Screen. availheight + 6 );



}

</ Script >

New window code

< Script Language = Javascript >

Function Closeold ()

{

Window. opener. Opener = Null ;

Window. opener. Close ();

}

Closeold ();

</ Script >



Window. Opener indicates the old window


That is, when the window is initialized, close the old 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.