Javascript is so powerful that it does not have a good coding tool. I heard that. net2008 has a syntax prompt, but I still haven't used it. Let's talk about it in a few days! Solve the problem! I searched for the code snippet, and found the code snippet for future use!
Three pages are named frame.html?top.html=bottom.html.
Frame.html consists of two pages (bottom (bottom.html) under the top (top.html#). The Code is as follows:
<Frameset rows = "50%, 50%">
<Frame name = top src = "top.html">
<Frame name = bottom src = "bottom.html">
</Frameset>
Now, let's assume that top.html (the page above) has seven buttoners to refresh bottom.html (the page below). You can use the following seven statements to see which one is easy to use.
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:
<HTML>
<HEAD>
<TITLE> top.html </TITLE>
</HEAD>
<BODY>
<Input type = button value = "Refresh 1" onclick = "window. parent. frames [1]. location. reload ()"> <br>
<Input type = button value = "Refresh 2" onclick = "window. parent. frames. bottom. location. reload ()"> <br>
<Input type = button value = "Refresh 3" onclick = "window. parent. frames [''bottom'']. location. reload ()"> <br>
<Input type = button value = "Refresh 4" onclick = "window. parent. frames. item (1). location. reload ()"> <br>
<Input type = button value = "Refresh 5" onclick = "window. parent. frames. item (''bottom''). location. reload ()"> <br>
<Input type = button value = "Refresh 6" onclick = "window. parent. bottom. location. reload ()">
; <Br>
<Input type = button value = "Refresh 7" onclick = "window. parent [''bottom'']. location. reload ()"> <br>
</BODY>
</HTML>
The following is the source code of the bottom.html page. to verify that the page below is refreshed, a dialog box is displayed after the page is loaded.
The code for the bottom.html page is as follows:
<HTML>
<HEAD>
<TITLE> bottom.html </TITLE>
</HEAD>
<BODY onload = "alert ('' I have been loaded! '')">
<H1> This is the content in bottom.html. </BODY>
</HTML>
Explanations:
1. windowless refers to the front page. For example, this refers to the top.html page.
2. parent refers to the parent page of the current page, that is, the framework page containing it. In this example, framedemo.html is used.
3. frames is a window object and an array. Represents all the child pages in the framework.
4. item is a method. Returns the elements in the array.
5. If the sub-page is also a framework page and contains other sub-pages, some of the above methods may not work.
Appendix:
How to refresh the page with Javascript:
1 history. go (0)
2 location. reload ()
3 location = location
4 location. assign (location)
5 document.exe cCommand (''refresh '')
6 window. navigate (location)
7 location. replace (location)
8 document. URL = location. href
How to automatically refresh the page:
1. Automatically refresh the page: Add the following code to the <Meta http-equiv = "refresh" content = "20">
20 indicates refreshing the page every 20 seconds.
2. automatic page Jump: Add the following code to the <Meta http-equiv = "refresh" content = "20; url = http://www.bkjia.com">
20 means jump to the http://www.bkjia.com page every 20 seconds
3. Automatically refresh js version on the page
<Script language = "JavaScript">
Function myrefresh ()
{
Window. location. reload ();
}
SetTimeout (''myrefresh () '', 1000); // refresh once per second
</Script>
How does ASP. NET output the script statement for refreshing the parent window?
1. this. response. write ("<script> opener. location. reload (); </script> ");
2. this. response. write ("<script> opener. window. location. href = opener. window. location. href; </script> ");
3. response. write ("<script language = javascript> opener. window. navigate (''' the page you want to refresh. asp '''); </script> ")
JS refresh framework script statement
// How to refresh the page containing the framework
<Script language = JavaScript>
Parent. location. reload ();
</Script>
// Refresh the parent window in the Child Window
<Script language = JavaScript>
Self. opener. location. reload ();
</Script>
(Or <a href = "javascript: opener. location. reload ()"> refresh </a>)
// How to refresh the page of another framework
<Script language = JavaScript>
Parent. Another FrameID. location. reload ();
</Script>
If you want to refresh the window when closing the window or refresh the window when opening the window, you can call the following statement in <body>.
<Body onload = "opener. location. reload ()"> refresh when opening a window
<Body onUnload = "opener. location. reload ()"> refresh when disabled
<Script language = "javascript">
Zookeeper opener.doc ument. location. reload ()
This is probably the case. I cannot remember it all at once. It will be nice to check it later.