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

How to deploy HTTPS for free on Tencent Cloud

Recently, when I was writing a WeChat applet, the...

Data URI and MHTML complete solution for all browsers

Data URI Data URI is a scheme defined by RFC 2397...

How to start Vue project with M1 pro chip

Table of contents introduction Install Homebrew I...

A brief discussion of 3 new features worth noting in TypeScript 3.7

Table of contents Preface Optional Chaining Nulli...

Calculation of percentage value when the css position property is absolute

When position is absolute, the percentage of its ...

Tutorial on installing MySQL 5.7.28 on CentOS 6.2 (mysql notes)

1. Environmental Preparation 1.MySQL installation...

MySQL Series 13 MySQL Replication

Table of contents 1. MySQL replication related co...

A brief introduction to mysql mycat middleware

1. What is mycat A completely open source large d...

How to assign a public IP address to an instance in Linux

describe When calling this interface, you need to...

WeChat applet realizes the effect of swiping left to delete list items

This article shares the specific code for WeChat ...

A simple example of mysql searching for data within N kilometers

According to the coefficient of pi and the radius...

Vue implements a simple shopping cart example

This article example shares the specific code of ...

MySQL cleverly uses sum, case and when to optimize statistical queries

I was recently working on a project at the compan...

Details on how to use class styles in Vue

Table of contents 1. Boolean 2. Expression 3. Mul...