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

Introduction to page reloading (current page/previous page) and frame or iframe element references in js

高洛峰
Release: 2017-01-12 11:22:16
Original
2105 people have browsed it

Use JavaScript to refresh the upper-level page and the current page

<script type="text/javascript"> 
//刷新上级页面 
//window.parent.main.document.location.reload(); 
//刷新当前页面 
document.location.reload(); 
</script>
Copy after login

Each frame element or iframe element is a frame. This frame is a window, and an html document is loaded in this window. Use the following methods You can reference frame or iframe elements:

window.frames[index] 
windows.frames["框架名"] 
windows.框架名
Copy after login

If you want to get a reference to the parent window from the web page loaded by the frame, then you can use the following method:

window.parent
Copy after login

If you want to get a reference to the parent window If you have a reference to a frame in the window, you can use the following method:

window.parent.框架名
Copy after login

You can also use the following method to get a reference to the top frame of the parent window:

window.top
Copy after login

More js For related articles, please pay attention to the PHP Chinese website!

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