|
通過重定向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="打開另一個頁面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>
通過重寫URL,打開了要跳轉的頁面test2.html
</BODY>
</HTML>
附:頁面跳轉的各種方法
第一種:
<script language="Javascript" type="text/Javascript">
window.location.href="/login.jsp?backurl="+window.location.href;
</script>
第二種:
<script language="Javascript">
alert("返回");
window.history.back(-1);
</script>
第三種:
<script language="Javascript">
window.navigate("top.jsp");
</script>
第四種:
<script language="JavaScript">
self.location='top.htm';
</script>
第五種:
<script language="Javascript">
alert("非法訪問!");
top.location='xx.jsp';
</script>
=====Javascript中彈出選擇框跳轉到其他頁面=====
<script language="Javascript">
<!--
function logout()...{
if (confirm("你確定要注銷身份嗎?是-選擇確定,否-選擇取消"))...{
window.location.href="/logout.ASP?act=logout"
}
}
-->
</script>
=====Javascript中彈出提示框跳轉到其他頁面=====
<script language="Javascript">
<!--
function logout()...{
alert("你確定要注銷身份嗎?");
window.location.href="/logout.ASP?act=logout"
}
-->
</script>
JavaScript技術:javascript打開新窗口同時關閉舊窗口,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。