Window object in JS: Open windows

Source: Internet
Author: User

~~

window.open (): Open a Window

You need to put three parameters inside:

1. Open the location of the window (webpage);

2. Open the Way (Self page, new page);

Where _blank opens a new window

3. Open the properties of the Web page;

window.open ("http://www.baidu.com","_blank"," width=500 height=500 ")

Window.close (): Close a window

Window.opener.close: Closes the open window (closes the source window)

~~

Interval and delay

Interval: setinterval

Window.setinterval ("Code to execute", "interval number of seconds")

The two parameters inside:

The first piece of code to execute;

The second interval is executed once (milliseconds);

Purge interval:

1. You need to write a variable to the interval:

var AA = window.setinterval ("code name", 1000);

2. In the function method:

Window.clearinterval (AA);//Clear Interval clearinterval


This will only be performed once

Delay: SetTimeout

Window.settimeout ("code name", how many seconds delay after execution (once));

Delay is only performed once

If you write again in the function, you will have a spacer effect:

Function Shao () {    window.open ("http://www.baidu.com");    Window.settimeout ("Shao ()", "}window.settimeout" ("Shao ()", 1000)//Purge delay: cleartimeout (variable)

modal dialog box (ie only):

Function Mo () {    window.showmodaldialog ();//showmodaldialog modal dialog Box}//showmodelessdialog (): Non-modal dialog box

Modal dialog box: Open post-top, similar to mask layer, click not to the rear.

~~

Forward a page:

Window.history.forward ()

Back one page:

Window.history.back ();

Get page Address:

Window.location.href

Jump page:

Window.location.href= "";

.

Window object in JS: Open windows

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.