Home  >  Article  >  Web Front-end  >  How to implement page jump in javascript

How to implement page jump in javascript

coldplay.xixi
coldplay.xixiOriginal
2021-03-31 11:19:0111919browse

Javascript method to implement page jump: 1. Open a new page on the current page by modifying the address link attribute [location.href] of the form object window; 2. You can call the [location.href] of the form object window open()] method implementation.

How to implement page jump in javascript

The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.

How to implement page jump using javascript:

1. Open a new page on the current page

By modifying the address link attribute of the form object window location.href implements opening a new page in the current page, that is,

< language="java" type="text/java">
window.location.href="http://110.html";
</>

2. To implement opening a new page in a new window

can be achieved by calling the open() method of the form object window.

That is: window.open('http://hx110.com');

3. Jump back to the previous page

< language="java">
alert("返回");
window.history.back(-1);
</>

4. self: current Window object (if it is in an iframe, it is the window object of the frame)

< language="Java">
self.location=&#39;top.html&#39;;
</>

5. Pop-up prompt box jumps to other pages

< language="java">
<!--
function logout()...{
alert("你确定要注销身份吗?");
window.location.href="http://110.html"
}

Related free learning Recommended: javascript video tutorial

The above is the detailed content of How to implement page jump in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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