Implementation of returning to the previous page and refreshing the page by ja vasc ript
1. ja vasc rept: return to the previous page history. go (-1), and return two pages: history. go (-2 );
2. history. back ().
3. window. history. forward () returns the next page
4. window. history. go (return the page number, or use the accessed URL)
Example:
[Code] xm l code:
<A href = "ja vasc rept: history. go (-1);"> previous page </a>
Response. Write ("<SC rept language = ja vasc rept> ")
Response. Write ("if (! Confirm ('finish the task? ') {History. back ();}")
Response. Write ("</SC ript> ")
Response. Write ("<SC rept language = ja vasc rept> history. go (-1); </SC ript> ")
<A href = "ja vasc rept: history. go (-1);"> previous page </a>
Page jump: on click = "window. location. href = 'list. php '"
P.S.
Tips (JS reference JS ):
[Code] xm l code:
<SC riptype = text/ja vasc rept>
<! --
If (typeof SWFob ject = "undefined "){
Document. write ('<scr' + 'ept type = "text/ja vasc ript" src = "/SC ripts/swfob ject-1.5.js"> </scr '+ 'ipt ');}
// -->
</SC ript>
Ja vasc ript:
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
<Me ta http-equiv = "refresh" content = "20">
20 indicates refreshing the page every 20 seconds.
2. automatic page Jump: Add the following code to the
<Me ta http-equiv = "refresh" content = "20; url = http://www.php2.cc">
20 means jump to the http://www.php2.cc page every 20 seconds
3. Automatically refresh js version on the page
[Code] xm l code:
1 <SC rept language = "ja vasc rept">
2 function myrefresh ()
3 {
4 window. location. reload ();
5}
6 setTimeout ('myrefresh () ', 1000); // refresh once per second
7 </SC ript>
How does PHP output the script statement for refreshing the parent window?
1. echo "<SC ript> opener. location. reload (); </SC ript> ";
2. echo "<SC ript> opener. window. location. href = opener. window. location. href; </SC ript> ";
3. echo "<SC rept language = ja vasc rept> opener. window. navigate (''page you want to refresh. php''); </SC ript>"
// How to refresh the page containing the framework
[Code] xm l code:
<SC riplanguage = ja vasc rept>
Parent. location. reload ();
</SC ript>
// Refresh the parent window in the Child Window
[Code] xm l code:
<SC riplanguage = ja vasc rept>
Self. opener. location. reload ();
</SC ript>
(Or <a href = "ja vasc rept: opener. location. reload ()"> refresh </a>)
// How to refresh the page of another framework
[Code] xm l code:
<SC riplanguage = ja vasc rept>
Parent. Another fr ameID. location. reload ();
</SC ript>
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 on load = "opener. location. reload ()"> refresh when opening a window
<Body on unload = "opener. location. reload ()"> refresh when disabled
<SC riplanguage = "ja vasc rept">
Zookeeper opener.doc ument. location. reload ()
</SC ript>