js returns to the previous page and refreshes the code

js returns to the previous page and refreshes the code
1. Javascript returns to the previous page history.go(-1), returns two pages: history.go(-2);
2. history.back().
3. window.history.forward() returns to the next page
4. window.history.go (return to the page number, you can also use the visited URL)
example:
<a href="javascript:history.go(-1);">Up page</a>
response.Write("<script language=javascript>")
response.Write("if(!confirm('Complete the task?')){history.back();}")
response.Write("</script>")
response.Write("<script language=javascript>history.go(-1);</script>")
<a href="javascript:history.go(-1);">Up page</a>
Page jump: onclick="window.location.href='list.aspx'"
PS
Tips (JS references JS):
<script type=text/javascript>
<!--
if (typeof SWFObject == "undefined") {
document.write('<scr' + 'ipt type="text/javascript" src="/scripts/swfobject-1.5.js"></scr' + 'ipt>');}
//-->
</script>
Several ways to refresh the page with Javascript:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
How to automatically refresh the page:
1. Automatic page refresh: Add the following code to the <head> area
<meta http-equiv="refresh" content="20">
20 means refreshing the page every 20 seconds.
2. Automatic page jump: Add the following code to the <head> area
<meta http-equiv="refresh" content="20;url=http://www.javaeye.com">
20 means jumping to http://www.javaeye.com after 20 seconds.
3. Page automatic refresh js version
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //Specify refresh once every 1 second
</script>
How to output script statements to refresh the parent window in ASP.NET
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 frame script statement
//How to refresh the page containing the frame
<script language=JavaScript>
parent.location.reload();
</script>
//The child window refreshes the parent 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 frame
<script language=JavaScript>
parent.anotherFrameID.location.reload();
</script>
If you want to refresh when closing the window or when opening the window, just call the following statement in <body>.
<body onload="opener.location.reload()"> Refresh when opening the window
<body onUnload="opener.location.reload()"> Refresh on close
<script language="javascript">
window.opener.document.location.reload()
</script>

<<:  Navigation Design and Information Architecture

>>:  MySQL query optimization using custom variables

Recommend

Three.js realizes Facebook Metaverse 3D dynamic logo effect

Table of contents background What is the Metavers...

Talking about Less and More in Web Design (Picture)

Less is More is a catchphrase for many designers....

Sample code using the element calendar component in Vue

First look at the effect diagram: The complete co...

How to control the startup order of docker compose services

summary Docker-compose can easily combine multipl...

How to set the width attribute to the style of the span tag

If you directly set the width attribute to the sty...

Use Nginx to build a streaming media server to realize live broadcast function

Written in front In recent years, the live stream...

A brief discussion on the execution details of Mysql multi-table join query

First, build the case demonstration table for thi...

RGBA alpha transparency conversion calculation table

Conversion between rgba and filter values ​​under...

How to import Chinese data into csv in Navicat for SQLite

This article shares with you the specific method ...

Mysql get table comment field operation

I won't say much nonsense, let's just loo...

How to install Mysql5.7 in Centos6

environment Centos 6.6 MySQL 5.7 Install If the s...

MySQL 5.5.27 installation graphic tutorial

1. Installation of MYSQL 1. Open the downloaded M...