Home > Web Front-end > JS Tutorial > Detailed explanation of usage examples of js setTimeout opener_Basic knowledge

Detailed explanation of usage examples of js setTimeout opener_Basic knowledge

WBOY
Release: 2016-05-16 17:19:04
Original
1093 people have browsed it
Copy code The code is as follows:

$("#saveInfo").show();
setTimeout( '$("#saveInfo").hide();',3000);
if(opener&& !opener.closed){ ​​
opener.location.reload(true);
}

setTimeout: How long to delay execution of which method, specific use: http://www.jb51.net/article/35535.htm

opener: refers to parent represents the parent window. For example, if page A uses iframe or frame to call page B, then the window where page A is located is the parent of page B. In JS, window.opener is just a reference to the pop-up window's parent window. For example: in a.html, window.open opens a new window b.html by clicking a button. Then in b.html, you can use window.opener (omitted and written as opener) to reference a.html, including a.html's document and other objects, and operate the content of a.html.
If this reference fails, null will be returned. Therefore, before calling the opener object, you must first determine whether the object is null, otherwise a JS error of "the object is empty or does not exist" will occur.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template