Home  >  Article  >  Web Front-end  >  Introduction to page reloading (current page/previous page) and frame or iframe element references in js

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

高洛峰
高洛峰Original
2017-01-12 11:22:162037browse

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>

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.框架名

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

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.框架名

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

window.top

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

Statement:
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