JavaScript opens new window while closing old Windows _javascript tips

Source: Internet
Author: User
Tags generator old windows
In fact, this problem and browser version is closely related, as a rookie of me, until now also did not find the perfect solution. No way, because the business has to be implemented, so have to do it in another way:
"Close" the old window while opening a new window by redirecting the URL
Test1.html
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> test1 </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
</HEAD>
<script type= "Text/javascript" >
function Tonewwindow () {
Window.top.location.href= "test2.html";
}
</script>
<BODY>
<input type= "button" value= "open another page test2.html" onclick= "Tonewwindow ()" >
</BODY>
</HTML>
Test2.html
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE>test2.html</TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
</HEAD>
<BODY>
The page to jump is opened by overriding the URL test2.html
</BODY>
</HTML>
Attached: Various methods of page jump
First type:
<script language= "javascript" type= "Text/javascript" >
window.location.href= "/login.jsp?backurl=" +WINDOW.LOCATION.HREF;
</script>
The second type:
<script language= "JavaScript" >
Alert ("return");
Window.history.back (-1);
</script>
The third type:
<script language= "JavaScript" >
Window.navigate ("top.jsp");
</script>
The fourth kind:
<script language= "JavaScript" >
self.location= ' top.htm ';
</script>
The fifth kind:
<script language= "JavaScript" >
Alert ("Illegal access!) ");
top.location= ' xx.jsp ';
</script>
=====javascript Pop-up selection box jump to another page =====
<script language= "JavaScript" >
<!--
function logout () ... {
if (confirm) ("Are you sure you want to cancel your identity?") Yes-Select OK, no-select Cancel ") ... {
window.location.href= "/logout.asp?act=logout"
}
}
-->
</script>
=====javascript pop-up prompt box jump to other page =====
<script language= "JavaScript" >
<!--
function logout () ... {
Alert ("Are you sure you want to cancel your identity?") ");
window.location.href= "/logout.asp?act=logout"
}
-->
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.