JavaScript refreshes the page in several ways:
1 history.go (0)
2 Window.location.reload ()
Window.location.reload (True)
3 location=location
4 Location.assign (location)
5 Document.execcommand ("Refresh")
6 Window.navigate (location)
7 Location.replace (location)
8 document. Url=location.href
Frame frames:
Frame.html:
<framesetrows= "50%,50%" >
<frame name=top src= "top.html" >
<frame name=bottomsrc= "bottom.html" >
</frameset>
Seven types of statements:
Statement 1.window.parent.frames[1].location.reload ();
Statement 2.window.parent.frames.bottom.location.reload ();
Statement 3.window.parent.frames["Bottom"].location.reload ();
Statement 4.window.parent.frames.item (1). Location.reload ();
Statement 5.window.parent.frames.item (' bottom '). Location.reload ();
Statement 6.window.parent.bottom.location.reload ();
Statement 7.window.parent[' Bottom '].location.reload ();
The code for the Top.html page is as follows:
<input Type=button value= "Refresh 1" onclick= "Window.parent.frames[1].location.reload ()" >
Bottom.html page:
<bodyonload= "alert (' I was loaded! ') ' >
</body>
1.window refers to the current page, for example it refers to the top.html page.
2.parent refers to the parent page of the current page, which is the frame page that contains it. For example, in this case, it refers to frame.html.
3.frames is a Window object and is an array. Represents all the sub-pages within the framework.
4.item is the method. Returns the elements inside the array.
5. If the sub-page is also a frame page, inside or another sub-page, then some of the above methods may not work.
Call the following statement in <body> if you want to refresh the window or refresh it when you want to open it.
<bodyonload= "Opener.location.reload ()" > Refresh when opening windows
<bodyonunload= "Opener.location.reload ()" > Refresh when off
child window refreshes parent window
<scriptlanguage=JavaScript>
Self.opener.location.reload ();
</script>
(or <ahref= "Javascript:opener.location.reload ()" > Refresh </a>)
JS Refresh page window.location.reload ();