1. Let's look at a simple example: the following names the three pagesFrame.html,Top.html,Bottom.htmlFor example, describe how to do this.
Frame.html consists of two pages (bottom (bottom.html) under the top (top.html#). The Code is as follows:
1 <! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"> 2 <HTML> 3 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.
The code for the 1top.html page is as follows: 2 3 <! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"> 4 <HTML> 5
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.
1 2 <! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"> 3 <HTML> 4 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: several methods for refreshing the page using 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
Ii. Automatically refresh the page 1. Automatically refresh the page: Add the following code to the <Meta http-equiv = "refresh" content = "20"> 20 means refreshing the page every 20 seconds.
2. automatic page Jump: Add the following code to the <Meta http-equiv = "refresh" content = "20; url = http://xcp.blogjava.net"> 20 means jump to the http://xcp.blogjava.net 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>
3. When Java writes servler, action, and other programs, it needs to perform operations to return to the page (for example, after a window is opened, close the current page and refresh the parent page)
1 printwriter out = response. getwriter (); 2 out. write ("<SCRIPT type = \" text/JavaScript \ ">"); 3 // The Child Window refreshes the parent window 4 out. write ("self. opener. location. reload (); "); 5 // Close Window 6 out. write ("window. opener = NULL; "); 7 out. write ("window. close (); "); 8 out. write ("</SCRIPT> ");
Iv. js refresh framework script Statement 1. How to refresh the page containing the framework
<Script language = JavaScript> parent. Location. Reload (); </SCRIPT>
2. Refresh the parent window in the Child Window
<Script language = JavaScript> self. opener. Location. Reload (); </SCRIPT>
3. How to refresh the page of another framework)
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 ();
4. 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 <body onUnload =" opener. location. reload () "> refresh when disabled <script language =" JavaScript "> expose your opener.doc ument. location. reload () </SCRIPT>