Home Web Front-end JS Tutorial js returns to the previous page and refreshes the code _javascript skills

js returns to the previous page and refreshes the code _javascript skills

May 16, 2016 pm 05:45 PM
Previous page refresh return

1: JS reload the page, refresh locally, return to the previous page
Copy the code The code is as follows:

How to write the JS code that returns the first two pages and refreshes them.
Copy code The code is as follows:

history.go(-2);
location .reload();

Two: js method
Copy code The code is as follows:

asp Method to automatically return and refresh:
Copy code The code is as follows:

response.Write(" ")

Generally used to submit an action to a page and then return to the previous page and refresh it!

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 which page, you can also use the visited URL)

Example:
Previous page

response.Write("")
response.Write("")
Previous page

Page jump: onclick="window.location.href='list.aspx'"
P.S.
Tips (JS citing JS):

Several ways to refresh the page using 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

Methods to automatically refresh the page:
1. Automatically refresh the page: Add the following code to the area

Of which 20 refers to refreshing the page every 20 seconds.

2. Automatic page jump: add the following code to the area

The 20th finger will jump to the http://www.javaeye.com page after 20 seconds

3. The page automatically Refresh the js version


How ASP.NET outputs the refresh parent window script statement

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("")

JS script statement to refresh the frame

//How to refresh the page containing the frame using

(OrRefresh )

//How to refresh the page of another frame using


If you want to refresh when the window is closed or you want to refresh when the window is opened, in < Just call the following statement in body>.

Refresh when opening the window
Refresh when closing




Three: Use JS in ASP to return to the previous page and refresh
Use JS in ASP to return to the previous page and refresh it. I think it is often used when developing websites using ASP. But there are several ways to write it, but the purpose is the same.

Copy code The code is as follows:

<%
response.write("Deleted successfully! font>")
% >

The function implemented by this code is to inform the user that if the implemented function has been achieved, but after returning It is best to refresh the original page so that new information is displayed or deleted items are not displayed. But this code cannot refresh the original web page when returning.
So you need to add this piece of code to the original page:
<script> <br>if(window.name != "Bencalie"){ <br>//If the name attribute of the page is not specified Refresh it with the name <br>location.reload(); <br>window.name = "Bencalie"; <br>} <br>else{ <br>//If the name attribute of the page is the specified name, nothing Do not do it, avoid constant refreshing <br>window.name = ""; <br>} <br></script>

This way we can achieve our goal - return to the top page and refresh.
Of course there is a simpler code than this, response.write"<script>alert('Deletion successful!');window.location='Original page'';</script>"
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

6 Ways to Refresh Web Pages on iPhone 6 Ways to Refresh Web Pages on iPhone Feb 05, 2024 pm 02:00 PM

When you browse the web on your iPhone, the loaded content is temporarily stored as long as the browser app remains open. However, the website updates content regularly, so refreshing the page is an effective way to clear out old data and see the latest published content. This way, you always have the latest information and experiences. If you want to refresh the page on iPhone, the following post will explain you all the methods. How to Refresh Web Pages on Safari [4 Methods] There are several methods to refresh the pages you are viewing on the Safari App on iPhone. Method 1: Use the Refresh Button The easiest way to refresh a page you have open on Safari is to use the Refresh option on your browser's tab bar. If Safa

F5 refresh key not working in Windows 11 F5 refresh key not working in Windows 11 Mar 14, 2024 pm 01:01 PM

Is the F5 key not working properly on your Windows 11/10 PC? The F5 key is typically used to refresh the desktop or explorer or reload a web page. However, some of our readers have reported that the F5 key is refreshing their computers and not working properly. How to enable F5 refresh in Windows 11? To refresh your Windows PC, just press the F5 key. On some laptops or desktops, you may need to press the Fn+F5 key combination to complete the refresh operation. Why doesn't F5 refresh work? If pressing the F5 key fails to refresh your computer or you are experiencing issues on Windows 11/10, it may be due to the function keys being locked. Other potential causes include the keyboard or F5 key

How to quickly refresh a web page? How to quickly refresh a web page? Feb 18, 2024 pm 01:14 PM

Page refresh is very common in our daily network use. When we visit a web page, we sometimes encounter some problems, such as the web page not loading or displaying abnormally, etc. At this time, we usually choose to refresh the page to solve the problem, so how to refresh the page quickly? Let’s discuss the shortcut keys for page refresh. The page refresh shortcut key is a method to quickly refresh the current web page through keyboard operations. In different operating systems and browsers, the shortcut keys for page refresh may be different. Below we use the common W

PHP Tips: Quickly Implement Return to Previous Page Function PHP Tips: Quickly Implement Return to Previous Page Function Mar 09, 2024 am 08:21 AM

PHP Tips: Quickly implement the function of returning to the previous page. In web development, we often encounter the need to implement the function of returning to the previous page. Such operations can improve the user experience and make it easier for users to navigate between web pages. In PHP, we can achieve this function through some simple code. This article will introduce how to quickly implement the function of returning to the previous page and provide specific PHP code examples. In PHP, we can use $_SERVER['HTTP_REFERER'] to get the URL of the previous page

What results does MySQL return after inserting data? What results does MySQL return after inserting data? Mar 01, 2024 am 10:27 AM

MySQL is a widely used relational database management system for storing and managing data. When we want to insert new data into a database table, we usually use the INSERT statement. In MySQL, when the INSERT statement is executed to successfully insert data, a result will be returned, which is the result of the insertion operation. In this article, we will discuss in detail the results returned by MySQL after inserting data and provide some specific code examples. 1. The result returned after inserting data is in MySQL. When successfully executed

What should I do if the value disappears after the react page is refreshed? What should I do if the value disappears after the react page is refreshed? Dec 29, 2022 am 11:11 AM

The solution to the value disappearing after the react page is refreshed: 1. Refresh the page and check whether the data in the state will be cleared; 2. Use the "const name = location.query.name; const id = location.query.id;" method By adding parameters to the jump link, you can pass the parameters and refresh the page without losing the data.

How to use Vue to implement the return to previous page effect How to use Vue to implement the return to previous page effect Sep 19, 2023 pm 01:07 PM

How to use Vue to implement the special effect of returning to the previous page. In front-end development, we often encounter situations where we need to return to the previous page. By adding a back button, you can provide a better user experience. This article will introduce how to use the Vue framework to achieve the special effect of returning to the previous page, and provide corresponding code examples. First, in the Vue project, you need to create a page as the previous page. We can set routing through VueRouter, and each route corresponds to a component. In the previous page, we can add a back button and pass the click event

What is the keyboard refresh shortcut key? What is the keyboard refresh shortcut key? Feb 25, 2024 pm 10:38 PM

What is the keyboard refresh shortcut key? With the development of computer technology, the keyboard has become an indispensable device in our daily work and life. The function of the keyboard goes far beyond entering text. It is also often used to operate various functions of the computer and improve our work efficiency. The keyboard shortcuts allow us to complete various operations more quickly and conveniently. In the daily use of computers, we often encounter situations where we need to refresh the page. When we open a web page or run software, sometimes the page will freeze or fail to load. At this time, refresh the page.

See all articles