


WEB page jump and value transfer method between pages implemented by JAVASCRIPT_javascript skills
But sometimes, when an event is triggered, we need to do some operations first and then jump. At this time, we need to use JAVASCRIPT to realize this jump function.
The following is the specific method:
1: Jump to a new page and open it in a new window:
function gogogo()
{
//do someghing here...
window.open("test2.html");
}
Window is a javascript object, and its open method can be used. It should be noted that if this page is not a relative path, then http:// must be added, for example:
function gogogo()
{
window .open( "http://www.google.com");
}
Two: Jump in the window of this page:
function totest2()
{
window.location.assign( "test2.html" );
}
You can also use location.assgin() directly, but window.location.assign() seems to be more reasonable, the assign() method of the location object of the current window.
In addition, the location object also has a method replace() that can also be used for page jumps. The difference between it and the assign() method is:
The replace() method will not generate a new record in the History object. When using this method, the new URL will overwrite the current record in the History object.
Let’s learn how to transfer values when the page jumps. When using window.open() to open a new page, the browser will think that there is an open and opened relationship between the two windows. , so in the new window that is opened, there is a window.opener attribute in the window object of the current window. This value contains the reference to the open window, so this value can be obtained, and then the value of the object in the previous page is referenced. An example is as follows:
These two pages can get the value in the previous page from the latter page, but I feel that it is not very practical. . . . . .
Advantages: It is convenient to obtain values. As long as window.opener points to the parent window, you can access all objects.
Not only can you access the value, but you can also access the methods of the parent window. There is no limit to the value length.
Disadvantages: Two The window must have a relationship. It is a window opened using window.open. It cannot cross domains.
Let’s look at another method, using URL additional fields to pass values between page jumps. When using XMLHttpRequest earlier, This method has been used. The simple original example is as follows:
我记得前面在看XMLHttpRequest的时候有一个QueryString对象可以直接从URL参数中取值,我不清楚这儿可不可以直接用,试了一下好像不行。
最后一种页面间传值的方法就是COOKIE共享,这个比较容易理解,由一个页面在客户端机器放置一个COOKIE文件,下一个页面访问的时候,直接读取这里面的值就OK了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Detailed explanation of PHP page jump functions: Page jump techniques for header, location, redirect and other functions, which require specific code examples. Introduction: When developing a Web website or application, jumping between pages is an essential function. PHP provides a variety of ways to implement page jumps, including header functions, location functions, and jump functions provided by some third-party libraries, such as redirect. This article will introduce in detail how to use these functions

Form validation is a very important link in web application development. It can check the validity of the data before submitting the form data to avoid security vulnerabilities and data errors in the application. Form validation for web applications can be easily implemented using Golang. This article will introduce how to use Golang to implement form validation for web applications. 1. Basic elements of form validation Before introducing how to implement form validation, we need to know what the basic elements of form validation are. Form elements: form elements are

Web standards are a set of specifications and guidelines developed by W3C and other related organizations. It includes standardization of HTML, CSS, JavaScript, DOM, Web accessibility and performance optimization. By following these standards, the compatibility of pages can be improved. , accessibility, maintainability and performance. The goal of web standards is to enable web content to be displayed and interacted consistently on different platforms, browsers and devices, providing better user experience and development efficiency.

Title: Using uniapp to achieve page jump animation effect In recent years, the user interface design of mobile applications has become one of the important factors in attracting users. Page jump animation effects play an important role in improving user experience and visualization effects. This article will introduce how to use uniapp to achieve page jump animation effects, and provide specific code examples. uniapp is a cross-platform application development framework developed based on Vue.js. It can compile and generate applications for multiple platforms such as mini programs, H5, and App through a set of codes.

Cockpit is a web-based graphical interface for Linux servers. It is mainly intended to make managing Linux servers easier for new/expert users. In this article, we will discuss Cockpit access modes and how to switch administrative access to Cockpit from CockpitWebUI. Content Topics: Cockpit Entry Modes Finding the Current Cockpit Access Mode Enable Administrative Access for Cockpit from CockpitWebUI Disabling Administrative Access for Cockpit from CockpitWebUI Conclusion Cockpit Entry Modes The cockpit has two access modes: Restricted Access: This is the default for the cockpit access mode. In this access mode you cannot access the web user from the cockpit

The web is a global wide area network, also known as the World Wide Web, which is an application form of the Internet. The Web is an information system based on hypertext and hypermedia, which allows users to browse and obtain information by jumping between different web pages through hyperlinks. The basis of the Web is the Internet, which uses unified and standardized protocols and languages to enable data exchange and information sharing between different computers.

How to use routing to implement page jump in Vue? With the continuous development of front-end development technology, Vue.js has become one of the most popular front-end frameworks. In Vue development, page jump is an essential part. Vue provides VueRouter to manage application routing, and seamless switching between pages can be achieved through routing. This article will introduce how to use routing to implement page jumps in Vue, with code examples. First, install the vue-router plugin in the Vue project.

Title: PHP code example: How to use POST to pass parameters and implement page jumps In web development, it often involves the need to pass parameters through POST and process them on the server side to implement page jumps. PHP, as a popular server-side scripting language, provides a wealth of functions and syntax to achieve this purpose. The following will introduce how to use PHP to implement this function through a practical example. First, we need to prepare two pages, one to receive POST requests and process parameters
