Home > Web Front-end > JS Tutorial > body text

Commonly used js.window properties and methods (detailed introduction, graphic tutorial)

亚连
Release: 2018-05-18 14:49:51
Original
1958 people have browsed it

The following are the js.window properties and methods that I have compiled for you. Interested students can take a look.

##window.opener.location.reload()

##​​

This method In the case of some IE browsers (such as high security settings), a confirmation dialog box will pop up, prompting whether to refresh the page again. This method is replaced by window.opener.location.href=window.opener.location .href;There will be no such problem.

window.opener.location.href is just a link

If you want to realize the submission of the parent window, you need to call the window.opener.action="" and window.opener.submit(); methods, but unfortunately this code cannot run under Firefox. The solution is to Write a submitted function in the window and call it through window.opener.functionname() in the child window.

Usually when using window.opener, you have to judge the status of the parent window. If the parent window is closed or updated, an error will occur. The solution is to add The following verification if(window.opener && !window.opener.closed)

window.opener.location.replace();

This method specifies URLReplace the item currently cached on the client, so after using the replace method, you cannot access the replaced URL through "forward" and "backward". In actual application, when refreshing the page, we usually use: location.reload() or history.go(0).
Because this approach is like the client clicking F5 to refresh the page, so when the page method="post" is used, a "webpage expired" prompt will appear. That's because of Session's security protection mechanism.

Method to open the window:

Method 1:

Response.Write("<script language=javascript>window.open(&#39;down.aspx&#39;,&#39;newwindow&#39;,&#39;width=200,height=200&#39;)</script>");
Copy after login

Method 2:

Response.Write("<script language=javascript>alert(&#39;注册成功&#39;);window.window.location.href=&#39;down.aspx&#39;;</script> ");
Copy after login

The above is the js.window properties and methods I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

JS loading jquery.jsDetailed steps

Three types of JS loading Summary of method usage

#Several common JS sorting codes on the front end

The above is the detailed content of Commonly used js.window properties and methods (detailed introduction, graphic tutorial). For more information, please follow other related articles on the PHP Chinese website!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!