Home  >  Article  >  Web Front-end  >  Summary of common implementation methods of Javascript page jump_javascript skills

Summary of common implementation methods of Javascript page jump_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:29:161265browse

The examples in this article summarize the common implementation methods of Javascript page jump. Share it with everyone for your reference, the details are as follows:

Overview

I believe many web developers know that when developing web programs, there are many ways to jump between pages, but effective jumps will get twice the result with half the effort. The following is what I use in my daily development process Let me share some JavaScript jump methods with you.

The first type: jump directly and add parameters

<script language="javascript" type="text/javascript">
  window.location.href="login.jsp&#63;backurl="+window.location.href; 
</script>

Jump directly without parameters:

Copy code The code is as follows:
3f1c4e4b6b16bbbd69b2ee476dc4f83awindow.location.href='http://www.baidu .com';2cacc6d41bbb37262a98f745aa00fbf0

Second type: Return to the last preview interface
<script language="javascript">
alert("返回");
window.history.back(-1);
</script>

Tag nesting:

<a href="javascript:history.go(-1)">返回上一步</a>
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>

The third type: specifying the jump page is invalid for the frame.

<script language="javascript">
 window.navigate("top.jsp");
</script>

The fourth method: specifying the own jump page is invalid for the frame.

<script language="JavaScript">
 self.location='top.htm';
</script>

The fifth method: specifying the own jump page is valid for frames.

<script language="javascript">
 alert("非法访问!");
 top.location='xx.aspx';
</script>

The sixth type: button type Add event jump to the button button.

Copy code The code is as follows:
28b158cbc1bf75f58949b82046db22ce


Type 7: Open in new window:
Copy code The code is as follows:
a9ae259458d8fc8338c53d6f85000798Open new window5db79b134e9f6b82c0b36e0489ee08ed


Application examples:
<head> 
<script language="javascript">
function old_page() 
{ 
window.location = "login.aspx" 
} 
function replace() 
{ 
window.location.replace("login.aspx") 
} 
function new_page() 
{ 
window.open("login.aspx") 
} 
</script> 
</head> 
<body> 
<input type="button" onclick="new_page()" value="在新窗口打开s"/> 
<input type="button" onclick="old_page()" value="跳转后有后退功能"/> 
<input type="button" onclick="replace()" value="跳转后没有后退功能"/> 
</body>

I hope this article will be helpful to everyone in JavaScript programming.

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